gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Inadvertent deletion of Procedure when Deleting episo


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Inadvertent deletion of Procedure when Deleting episode
Date: Fri, 2 Aug 2013 11:42:53 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Aug 02, 2013 at 09:12:17AM +0000, Jim Busser wrote:

> whereas I was, by doing the following in psql (hinted from 
> http://stackoverflow.com/a/1461750 ) ...
> 
>       SELECT pg_inherits.*, c.relname AS child, p.relname AS parent
>       FROM pg_inherits
>       JOIN pg_class AS c ON (inhrelid=c.oid)
>       JOIN pg_class AS p ON (inhparent=p.oid)
>       WHERE p.relname = 'clin_root_item'
>       ;
> 
> able to identify, within the database schemata, the descendent children of  
> clin_root_item ...
> 
>  inhrelid | inhparent | inhseqno |      child       |     parent     
> ----------+-----------+----------+------------------+----------------
>     17935 |     17858 |        1 | clin_narrative   | clin_root_item
>     18032 |     17858 |        1 | family_history   | clin_root_item
>     18092 |     17858 |        1 | clin_aux_note    | clin_root_item
>     18153 |     17858 |        1 | allergy          | clin_root_item
>     18189 |     17858 |        1 | form_instances   | clin_root_item
>     18555 |     17858 |        1 | vaccination      | clin_root_item
>     18753 |     17858 |        1 | test_result      | clin_root_item
>     18794 |     17858 |        1 | lab_request      | clin_root_item
>     20517 |     17858 |        1 | referral         | clin_root_item
>     22421 |     17858 |        1 | hospital_stay    | clin_root_item
>     22469 |     17858 |        1 | substance_intake | clin_root_item
>     23241 |     17858 |        1 | procedure        | clin_root_item
> (12 rows)

Sure, that works as well.

> and further, after consulting
> 
>       http://www.postgresql.org/docs/current/interactive/ddl-inherit.html
> 
> I was able to do the following to see some of the data from these tables
> 
>       SELECT p.relname, pk_item, clin_when, substr(narrative, 1, 40)
>       FROM clin.clin_root_item f, pg_class p
>       WHERE f.tableoid = p.oid;

Sure but what does this demonstrate ?

You could just as well have said:

SELECT
        tableoid::regclass AS relname,
        pk_item,
        clin_when,
        substr(narrative from 1 for 40)
FROM
        clin.clin_root_item
;

and not need pg_class at all. However, this does not prove
anything as far as I can see. What was your intent ?

Karsten
-- 
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346



reply via email to

[Prev in Thread] Current Thread [Next in Thread]