Re: BUG #2379: Duplicate pkeys in table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2379: Duplicate pkeys in table
Date: 2006-04-06 15:51:29
Message-ID: 24907.1144338689@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
> public | tg_update_qqq_date | "trigger"
> | | mail | plpgsql |
> Declare
> uid bigint;
> Begin
> uid = (select owner_id from yyy m where m.f1 = NEW.f1);
> if (uid <> 0 and not uid is null) then
> update xxx set qqq_date = 'now' where id=uid;
> end if;
> Return NEW;
> End; |

> and there's also a rewrite rule:

> zzz_update_r1 AS
> ON UPDATE TO zzz DO INSTEAD UPDATE xxx SET f1 = new.f1
> WHERE xxx.id = new.id
> zzz_update_r2 AS
> ON UPDATE TO zzz DO INSTEAD UPDATE xxx SET f2 = new.f2
> WHERE xxx.id = new.id

OK, I'm a bit confused by the obfuscation here. The table with the
duplicates is xxx, or qqq? Which one is the trigger attached to?
zzz is a view I suppose?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Philip Warner 2006-04-06 16:01:42 Re: BUG #2379: Duplicate pkeys in table
Previous Message Kevin Grittner 2006-04-06 15:40:50 right sibling is not next child