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: Busser, Jim
Subject: Re: [Gnumed-devel] Inadvertent deletion of Procedure when Deleting episode
Date: Fri, 2 Aug 2013 09:12:17 +0000

On 2013-08-01, at 1:26 PM, Karsten Hilbert <address@hidden> wrote:

> On Thu, Aug 01, 2013 at 07:54:05PM +0000, Jim Busser wrote:
> 
>>> AND If rows in the clin.clin_root_item table are not supposed to be able to 
>>> be deleted
>> 
>> Which I attempted after creating another test item:
>> 
>>      gnumed_v18=> delete from clin.clin_root_item where pk_item = 1071 ;
>>      ERROR: INSERT/DELETE on <clin_root_item> not allowed. 
>> 
>> … so how still to account for "missing" clin.clin_root_items ????
> 
> Sorry but I don't yet believe in them before I have seen
> them.

I think the answer to your above resides among your last few posts, wherein you 
explained about the exceptions.

Incidentally, despite that

        clin.clin_root_item

is in *GNUmed* not supposed to have its own rows, existing descendent (child) 
rows should nevertheless be invoked from

        SELECT * FROM clin.clin_root_item

about which child tables I could not discern anything from

        \d+ clin.clin_root_item

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)

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;

-- Jim




reply via email to

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