Re: self-referential UPDATE problem on 7.4

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: self-referential UPDATE problem on 7.4
Date: 2007-01-04 17:37:23
Message-ID: 20070104173723.GD3969@merkur.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 04, 2007 at 11:36:35AM -0500, Tom Lane wrote:

> > update clin.episode
> > set fk_patient = clin.health_issue.fk_patient
> > from clin.health_issue
> > where
> > clin.episode.fk_patient is NULL and
> > clin.episode.fk_health_issue = clin.health_issue.pk;
>
> > It returns "UPDATE 2" which is what I expect from the data.
> > However, the rows in question are not actually updated.
>
> That seems very strange. Could you perhaps have a BEFORE UPDATE trigger
> that's changing the values back to null again?
I do but I drop that one in the script before doing the
above update. I may have an old one hanging around, though,
I'll double-check.

Thanks,
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GUNDUZ 2007-01-04 17:42:31 Re: pg_dump question
Previous Message Richard Huxton 2007-01-04 17:35:21 Re: pg_dump question