gnumed-devel
[Top][All Lists]
Advanced

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

Re: [Gnumed-devel] Upgrade psql


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Upgrade psql
Date: Sat, 23 Nov 2013 13:40:01 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Nov 23, 2013 at 11:36:04AM +0530, Vaibhav Banait wrote:

> > select * from clin.v_substance_intakes where pk_episode = 555;
> > 
> > Results in error clin.v_Substance_intake(s) - no such entry exist in 
> > database 
> 
> Please try the following query against your v18 database:
> 
>       select * from clin.v_pat_substance_intake where pk_episode = 555;

> Here it goes. kindly see attached files. 

OK, this seems to suggest that the two 555'er entries
belong to the same patient (which was luckily still
linked via fk_encounter). At one point in time those
substance intakes were properly linked to an episode
but that episode had been deleted at some point in
the past which was possible because there must have
been a lack of a foreign key from
clin.substance_intake.fk_episode to clin.episode.pk
at that point in time. There surely is now in a
normal database.

Perhaps the problem is fixed now (it likely is for
at least those two entries).

The old-and-deleted episode can probably be found with:

        select * from audit.log_episode where pk = 555;

Also, it would be very helpful to see whether the
table actually has a foreign key in your database
at least *now*:

        - connect with psql
        - run
                $> \d clin.substance_intake

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]