Search Postgresql Archives

Re: new rows based on existing rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3 May 2012, at 24:00, Tom Lane wrote:

> Andy Chambers <achambers@xxxxxxxx> 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.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux