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: Thu, 1 Aug 2013 16:05:01 +0000

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

> On Thu, Aug 01, 2013 at 11:55:18AM +0200, Karsten Hilbert wrote:
> 
>> I found the explanation of why it was possible to delete the
>> clin.episode row with the clin.procedure /
>> clin.clin_root_item rows staying in place. Under Inheritance
>> the PG Manual says:
>> 
>>      All check constraints and not-null constraints on a
>>      parent table are automatically inherited by its
>>      children. Other types of constraints (unique, primary
>>      key, and foreign key constraints) are not inherited.
> 
> Attached find a script which can be run from within
> .../client/testing/ against, say, gnumed_v18 as the GNUmed
> database owner which will list rows pointing to non-existent
> episodes or encounters and will take a look at the audit
> tables to find the DELETEd episodes and encounters:
> 
>       $> python crawl-dangling-clin_root_items.py

My session follows. As expected, it shows no dangling rows because

1) I only just deleted an episode (to which a procedure had been attached) for 
the first time

and

2) I had already been unable to locate the existence of a clin.clin_root_item 
referencing the procedure which I had caused to disappear into the audit table.

-- JIm

===================

Please enter the required login parameters:
host ('' = non-TCP/IP) (CTRL-C aborts) []: 
database (CTRL-C aborts) [gnumed_v18]: gnumed_v18
user name (CTRL-C aborts) []: gm-dbo
password for "gm-dbo" (not shown): 
port (CTRL-C aborts) [5432]: 5432


Looking for dangling clin.clin_root_item rows ...

1) rows with dangling .fk_episode:

2) rows with dangling .fk_encounter:
MacBook-2:testing djb$ 
===================
end




reply via email to

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