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

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: [8.4] Updated WITH clause patch (non-recursive)
Дата
Msg-id 1201461182.1204.74.camel@goldbach
обсуждение исходный текст
Ответ на Re: [8.4] Updated WITH clause patch (non-recursive)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [8.4] Updated WITH clause patch (non-recursive)  ("Guillaume Smet" <guillaume.smet@gmail.com>)
Re: [8.4] Updated WITH clause patch (non-recursive)  ("Florian G. Pflug" <fgp@phlo.org>)
Список 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



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [8.4] Updated WITH clause patch (non-recursive)
Следующее
От: "Guillaume Smet"
Дата:
Сообщение: Re: [8.4] Updated WITH clause patch (non-recursive)