Re: factorial function/phase out postfix operators?

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: factorial function/phase out postfix operators?
Date: 2020-07-10 17:13:55
Message-ID: 86919A41-9635-437D-967D-7E5927C2F807@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Jun 30, 2020, at 2:47 PM, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> wrote:
>
>
>
>> On May 19, 2020, at 4:47 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>
>> I wrote:
>>> However, we do have to have a benefit to show those people whose
>>> queries we break. Hence my insistence on having a working AS fix
>>> (or some other benefit) before not after.
>>
>> I experimented with this a bit more, and came up with the attached.
>> It's not a working patch, just a set of grammar changes that Bison
>> is happy with. (Getting to a working patch would require fixing the
>> various build infrastructure that knows about the keyword classification,
>> which seems straightforward but tedious.)
>
> I built a patch on top of yours that does much of that tedious work.
>
>> As Robert theorized, it works to move a fairly-small number of unreserved
>> keywords into a new slightly-reserved category. However, as the patch
>> stands, only the remaining fully-unreserved keywords can be used as bare
>> column labels. I'd hoped to be able to also use col_name keywords in that
>> way (which'd make the set of legal bare column labels mostly the same as
>> ColId). The col_name keywords that cause problems are, it appears,
>> only PRECISION, CHARACTER, and CHAR_P. So in principle we could move
>> those three into yet another keyword category and then let the remaining
>> col_name keywords be included in BareColLabel. I kind of think that
>> that's more complication than it's worth, though.
>
> By my count, 288 more keywords can be used as column aliases without the AS keyword after the patch. That exactly matches what Robert said upthread.
>
> Tom and Álvaro discussed upthread:
>
>> Would it make sense (and possible) to have a keyword category that is
>> not disjoint wrt. the others? Maybe that ends up being easier than
>> a solution that ends up with six or seven categories.

Version 2, attached, follows this design, increasing the number of keywords that can be used as column aliases without the AS keyword up to 411, with only 39 keywords still requiring an explicit preceding AS.

Attachment Content-Type Size
v2-0001-Allow-most-keywords-to-be-used-as-implicit-column.patch application/octet-stream 82.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-07-10 17:16:40 Re: expose parallel leader in CSV and log_line_prefix
Previous Message Floris Van Nee 2020-07-10 17:03:37 RE: Index Skip Scan (new UniqueKeys)