Re: SQL feature requests

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Michael Glaesemann" <grzm(at)seespotcode(dot)net>, "Ben Tilly" <btilly(at)gmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SQL feature requests
Date: 2007-08-23 16:38:35
Message-ID: 87r6lu435g.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Alvaro Herrera" <alvherre(at)commandprompt(dot)com> writes:

> Gregory Stark escribió:
>
>> The upside is the convenience which after all is the same upside as most of
>> our spec grammar extensions. Many many programmers are accustomed to entering
>> ad-hoc queries of this form and forcing them to enter an alias for no purpose
>> is just silly pedanticism from their point of view. The portability of ad-hoc
>> queries is meaningless and if you don't refer to the alias in the query then
>> it's truly pointless.
>
> So there's the compromise: allow not specifying an alias only if it's
> not used in the rest of the query at all, so the subquery would be
> effectively anonymous.

If what's not used in the rest of the query? If you haven't specified the
alias what would you use? Surely even if we did generate an alias name nobody
would think the generated name was guaranteed to be stable and reference it?

I think the compromise is to instead of generating aliases at all just use an
alias like "*Anonymous Subquery*" and add a boolean flag indicating that that
range table is anonymous and not a valid target for references. I started
doing that a while back but got distracted (and discouraged since it seemed
not to have widespread support).

IMHO even generating non-anonymous aliases like "*Anonymous Subquery*1" would
be fine but I'm happy to have a flag hiding them too.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Glaesemann 2007-08-23 16:47:39 Re: SQL feature requests
Previous Message Tom Lane 2007-08-23 16:30:57 Re: SQL feature requests