Re: self-referential UPDATE problem on 7.4

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: self-referential UPDATE problem on 7.4
Date: 2007-01-04 16:36:35
Message-ID: 17992.1167928595@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net> writes:
> I am trying to run this query in psql:

> 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?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-01-04 16:38:00 Re: Moving from 7.2.1 to 8.1.5 - looking for jdbc
Previous Message Madison Kelly 2007-01-04 16:20:58 pg_dump question