Re: top-level DML under CTEs

From: Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: top-level DML under CTEs
Date: 2010-09-14 15:50:31
Message-ID: 4C8F99C7.5020103@cs.helsinki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-rrreviewers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-09-14 15:56:37 Re: Report: removing the inconsistencies in our CVS->git conversion
Previous Message Robert Haas 2010-09-14 15:49:57 Re: Report: removing the inconsistencies in our CVS->git conversion

Browse pgsql-rrreviewers by date

  From Date Subject
Next Message Hitoshi Harada 2010-09-14 18:59:43 Re: top-level DML under CTEs
Previous Message Hitoshi Harada 2010-09-14 00:44:46 Re: top-level DML under CTEs