Re: [8.4] Updated WITH clause patch (non-recursive)

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [8.4] Updated WITH clause patch (non-recursive)
Date: 2008-01-27 19:13:02
Message-ID: 1201461182.1204.74.camel@goldbach
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Sun, 2008-01-27 at 12:36 -0500, Tom Lane wrote:
> Both of the above arguments hold water only if we implement compatible
> *semantics*, not merely syntax, so I find them unconvincing at this
> stage.

How are the semantics of the proposed patch incompatible with the SQL
spec or the implementations in other systems? The proposed patch is a
*subset* of the functionality in the SQL spec, but it isn't incompatible
with it as far as I know (recursive and non-recursive WITH are distinct
features).

> > (3) It avoids the need to repeat subqueries multiple times in the main
> > query, which can make queries more concise. Defining subqueries outside
> > the main SELECT body can also have readability advantages.
>
> Views fix that too.

Sure, if you're willing to resort to DDL, and lose most of the
conciseness / readability gain.

> The point is that when you break people's apps you'll be able to point
> to some real increment in functionality to justify it.

If your application uses an identifier that is a reserved word in SQL-92
and in pretty much all major databases, I don't think you have much
cause for grievance when it becomes a reserved word in Postgres -- the
writing has been on the wall for a while. Do you have any reason to
think that "WITH" is a particularly common table or column name, by the
way?

Note also the keywords.c hack in 8.3 for the WITH keyword means that
pg_dump already treats WITH as a reserved word, so most dumps should
load without changes.

> With the patch as it stands you'd essentially be saying "we're going
> to cause you pain now for benefit later", which is a hard selling
> proposition.

Again, the readability + compatibility arguments are non-zero benefits,
IMHO. But your argument is essentially a public-relations one ("it will
look bad if..."), which I don't find very convincing. If we explain that
WITH is a reserved word per SQL spec and is part of the planned support
for recursive queries (whether in 8.4 or later), I can't see very many
users being annoyed.

(Compare that with the irritation we may well see from the removal of
implicit casts in 8.3, which will break *far* more applications, for a
benefit that many users will no doubt find rather hard to observe.)

-Neil

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Guillaume Smet 2008-01-27 19:24:00 Re: [8.4] Updated WITH clause patch (non-recursive)
Previous Message Tom Lane 2008-01-27 17:36:41 Re: [8.4] Updated WITH clause patch (non-recursive)