Re: WITH x AS (...) and visibility in UPDATE

From: David Johnston <polobo(at)yahoo(dot)com>
To: Peter V <peterv861908(at)hotmail(dot)com>
Cc: "<mmoncure(at)gmail(dot)com>" <mmoncure(at)gmail(dot)com>, "<pgsql-general(at)postgresql(dot)org>" <pgsql-general(at)postgresql(dot)org>
Subject: Re: WITH x AS (...) and visibility in UPDATE
Date: 2011-07-28 03:47:08
Message-ID: 0D33DFA4-2151-40FB-9123-62F1B63B864B@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> 1) create the copy of the row and return the identifier
> 2) apply updates on the new row identified by the identifier returned in step 1
>
> If possible, I want to write this in a single command, to avoid overhead and mistakes.
>
> I tried writing a rewrite rule or before trigger, but it becomes quickly a mess to avoid infinite loops.
>
> Any ideas are welcome. Thanks.
>
>
Insert into table (cols)
Select ... From table;

As mentioned previously just modify the original row before inserting it into the table as a new record.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nigel Heron 2011-07-28 04:19:38 issue with pg_restore
Previous Message sqldbxdeveloper 2011-07-28 01:51:05 Re: problems viewing information_schema.schemata