Re: Questionable behavior regarding aliasing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Questionable behavior regarding aliasing
Date: 2015-10-09 21:16:34
Message-ID: 47669.1444425394@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> I fat-fingered a view create and ended up with this:
> ...
> , schemaname, relname -- other
> now
> , d_now, ...
> I was about to report this as a bug until Marko Tiikkaja pointed out on
> IRC that now was being treated as an alias for relname.

> I'm not sure if this is required by the spec, but can we at least emit a
> WARNING if not reject this case outright?

SQL:2011 gives the syntax of a SELECT list element as

<derived column> ::=
<value expression> [ <as clause> ]
<as clause> ::=
[ AS ] <column name>

There is not a lot of room for argument there. And we got a lot of
complaints back when we didn't support omitting AS.

If we're going to get into the business of emitting warnings for
required-by-SQL-spec constructs, I'm not sure that this one is
where I'd start. Unqualified outer references seem to catch a
lot more people.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2015-10-09 21:31:50 Re: More work on SortSupport for text - strcoll() and strxfrm() caching
Previous Message Josh Berkus 2015-10-09 20:40:26 Re: bugs and bug tracking