From: | Alban Hertroys <haramrae(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andy Chambers <achambers(at)mcna(dot)net>, pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: new rows based on existing rows |
Date: | 2012-05-03 06:52:46 |
Message-ID: | 1E0490A0-C990-47B0-B371-FF6501B76A83@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 3 May 2012, at 24:00, Tom Lane wrote:
> Andy Chambers <achambers(at)mcna(dot)net> writes:
>> So ideally, I'd like to be able to do
>
>> insert into foo (a,b,foo_date)
>> select a,b,now() from foo old where ....
>> returning oid, old.oid
>
>> ...but this doesn't work. It seems you only have access to the table
>> being modified in a returning clause.
>
> For the moment I think all you could really do is what somebody else
> suggested, namely eat the overhead of having an "old_id" column in
> the table so that you can insert the value you want into that column,
> thus making it available to the RETURNING clause.
I was wondering, would an updatable view with a "pseudo-column" for the old_id do it?
Alban Hertroys
--
Screwing up is an excellent way to attach something to the ceiling.
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Reichstadt | 2012-05-03 07:08:53 | Memory Management in pqlib, Garbage Collection support |
Previous Message | Ben Madin | 2012-05-03 06:46:16 | Re: SQLSTATE XX000 Internal Error 7 |