Re: top-level DML under CTEs - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: top-level DML under CTEs
Date
Msg-id 4C8F99C7.5020103@cs.helsinki.fi
Whole thread Raw
In response to top-level DML under CTEs  (Hitoshi Harada <umi.tanuki@gmail.com>)
Responses Re: top-level DML under CTEs
List pgsql-hackers
On 2010-09-13 4:15 PM +0300, Hitoshi Harada wrote:
> 1. WITH clause atop INSERT
> Although the previous discussion got the consensus that we forbid WITH
> atop INSERT, it seems to me that it can be allowed. I managed to do it
> by treating the top WITH clause (of INSERT) as if the one of SELECT
> (or VALUES).

In the email you referred to, Tom was concerned about the case where 
these WITH lists have different RECURSIVE declarations.  This patch 
makes both RECURSIVE if either of them is.  I can think of cases where 
that might lead to surprising behaviour, but the chances of any of those 
happening in real life seem pretty slim.
> It is possible to disallow the CTE over INSERT statement,
> but the lack for INSERT, though there are for UPDATE and DELETE,
> sounds inconsistent enough.

Also because wCTEs are not allowed below the top level, not being able 
to use INSERT as the top level statement would force people to wrap that 
INSERT in another CTE.



Regards,
Marko Tiikkaja


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Report: removing the inconsistencies in our CVS->git conversion
Next
From: Tom Lane
Date:
Subject: Re: Report: removing the inconsistencies in our CVS->git conversion