Re: Writeable CTEs and side effects

Поиск
Список
Период
Сортировка
От Marko Tiikkaja
Тема Re: Writeable CTEs and side effects
Дата
Msg-id 4ACD0614.30800@cs.helsinki.fi
обсуждение исходный текст
Ответ на Re: Writeable CTEs and side effects  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Ответы Re: Writeable CTEs and side effects  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Список pgsql-hackers
Jaime Casanova wrote:
> On Wed, Oct 7, 2009 at 4:08 PM, Marko Tiikkaja
> <marko.tiikkaja@cs.helsinki.fi> wrote:
>> 1)      WITH t AS
>>        (UPDATE foo SET bar = bar+1 RETURNING *)
>>        SELECT * FROM t LIMIT 1;
>>
>> What's problematic here is that only 1 row is read from the CTE, meaning
>> also that only one row is updated which, at least how I see it, is not
>> what we want.  The CTE should only store one row and return that after
>> it has completely processed the UPDATE statement.
>>
> 
> i'm talking from my ignorance... but AFAIU this should process the
> whole UPDATE and then form a WorkTable with the results...
> what the select reads from that results is another thing...
> 

Right.  This is exactly what I'm trying to do, except I think we could
easily optimize this case and store only the first processed row inside
the CTE.

Regards,
Marko Tiikkaja


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

Предыдущее
От: "Brad T. Sliger"
Дата:
Сообщение: Re: Unicode UTF-8 table formatting for psql text output
Следующее
От: Jaime Casanova
Дата:
Сообщение: Re: Writeable CTEs and side effects