From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Jeff Davis <pgsql(at)j-davis(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Writeable CTEs and side effects |
Date: | 2009-10-08 23:23:43 |
Message-ID: | 1255044223.13157.11.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 2009-10-08 at 12:34 -0700, Jeff Davis wrote:
> I'm still trying to ponder the consequences of this. Most people
> assume
> that a single statement means that everything in the statement happens
> at once (intuitively). The few cases where that's not true are special
> commands or things that we are trying to fix, like:
> "UPDATE foo SET a = a + 1".
Well, the classical case of
INSERT INTO tab1 SELECT ... FROM tab1
clearly requires the SELECT to be distinctly before the INSERT.
Basically, this would not do it the other way around: write first, then
select.
I'm not sure why it needs to be tied in with CTEs, though. Why couldn't
this work:
SELECT * FROM test1 WHERE a IN (UPDATE test2 SET b = b + 1 RETURNING b);
I think I'd want "writable subqueries" instead of only "writable CTEs".
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2009-10-08 23:30:50 | Re: COPY enhancements |
Previous Message | Simon Riggs | 2009-10-08 23:15:14 | Re: COPY enhancements |