Re: BUG #2379: Duplicate pkeys in table - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2379: Duplicate pkeys in table
Date
Msg-id 24907.1144338689@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #2379: Duplicate pkeys in table  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: BUG #2379: Duplicate pkeys in table  (Philip Warner <pjw@rhyme.com.au>)
Re: BUG #2379: Duplicate pkeys in table  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-bugs
Philip Warner <pjw@rhyme.com.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

pgsql-bugs by date:

Previous
From: Philip Warner
Date:
Subject: Re: BUG #2379: Duplicate pkeys in table
Next
From: Philip Warner
Date:
Subject: Re: BUG #2379: Duplicate pkeys in table