[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] Upgrade psql
From: |
Sebastian Hilbert |
Subject: |
Re: [Gnumed-devel] Upgrade psql |
Date: |
Sat, 23 Nov 2013 14:21:18 +0100 |
User-agent: |
KMail/4.11.2 (Linux/3.11.0-14-generic; KDE/4.11.2; i686; ; ) |
Am Samstag, 23. November 2013, 13:40:01 schrieb Karsten Hilbert:
> 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
>
This should be checked in PG 8.4 (database v18)
Sebastian