Re: Review: UNNEST (and other functions) WITH ORDINALITY

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Review: UNNEST (and other functions) WITH ORDINALITY
Date: 2013-07-24 17:39:35
Message-ID: CA+TgmoZUneXCgO3HgjpOMog4gxTerYExyzxK=SXHmHvd0umGMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 19, 2013 at 1:50 PM, Greg Stark <stark(at)mit(dot)edu> wrote:
> My only reservation with this patch is whether the WITH_ORDINALITY
> parser hack is the way we want to go. The precedent was already set
> with WITH TIME ZONE though and I think this was the best option.

I share this reservation. Lexer hacks are reasonable ways of getting
LALR(2)-ish behavior in very simple cases, but it doesn't take much to
get into trouble. I think the with ordinality as (select 1) select *
from ordinality example you posted is precisely on point. Currently,
we will have four classes of keywords: unreserved, column-name,
type-function, and reserved. There are rules for when each of those
types of keywords needs to be quoted, and those rules are relatively
well-understood.

This patch will introduce, without documentation, a fifth class of
keyword. ORDINALITY will need to be quoted when, and only when, it
immediately follows WITH. Without some change to our deparsing code,
this is a dump/restore hazard; and with some such change it's still
probably not a good idea.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-07-24 17:40:44 Re: Review: UNNEST (and other functions) WITH ORDINALITY
Previous Message Tom Lane 2013-07-24 17:36:39 Re: Review: UNNEST (and other functions) WITH ORDINALITY