From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | Greg Stark <stark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bernd Helmle <mailings(at)oopsware(dot)de>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Make subquery alias optional in FROM clause |
Date: | 2017-02-24 17:19:33 |
Message-ID: | CAKFQuwYYY4OyJ2Z39v9NyZGwcEAGHRvymJ24zJhAjiV1u4F4pA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Feb 24, 2017 at 9:35 AM, David Fetter <david(at)fetter(dot)org> wrote:
>
> > => SELECT "?column"? FROM (select 1+1 as "?column?", 1+1) AS x;
> > ERROR: 42703: column "?column" does not exist
> > LINE 2: SELECT "?column"? FROM (select 1+1 as "?column?", 1+1) AS x;
> > ^
> > HINT: Perhaps you meant to reference the column "x.?column?" or the
> > column "x.?column?".
>
This is indirectly pointing out the duplication since the hint is
specifying the exact same name twice...
I don't know how far comparing apples and oranges gets us here...and the
assignment of names to expression columns lacking aliases is a bit smarter
than given credit for here - e.g., it uses the name of the function in a
simple function call expression.
There is no risk of naming conflicts in pre-existing queries. I say we do
something like: pg_subquery_n and make it known that the value for "n"
will be chosen independent of names already present in the query. We've
recently reserved the pg_ prefix for roles we might as well leverage that.
These names need only be available for internal needs; as a user I'd expect
it is be noted as an implementation detail that should not be relied upon.
Whether it needs to get exposed for technical reasons (e.g., dump/restore
and explain) I do not know.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2017-02-24 17:26:14 | Re: GUC for cleanup indexes threshold. |
Previous Message | Andrew Gierth | 2017-02-24 17:15:50 | Re: Hash support for grouping sets |