Re: new rows based on existing rows

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: new rows based on existing rows
Дата
Msg-id 1E0490A0-C990-47B0-B371-FF6501B76A83@gmail.com
обсуждение исходный текст
Ответ на Re: new rows based on existing rows  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On 3 May 2012, at 24:00, Tom Lane wrote:

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


В списке pgsql-general по дате отправления:

Предыдущее
От: Ben Madin
Дата:
Сообщение: Re: SQLSTATE XX000 Internal Error 7
Следующее
От: Alexander Reichstadt
Дата:
Сообщение: Memory Management in pqlib, Garbage Collection support