Re: Review: UNNEST (and other functions) WITH ORDINALITY - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Review: UNNEST (and other functions) WITH ORDINALITY
Date
Msg-id CAM-w4HN0vVvhjt+m-HqDPTXewPBJp-sLy0E9cOjCwCmeTjMwYA@mail.gmail.com
Whole thread
In response to Re: Review: UNNEST (and other functions) WITH ORDINALITY  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Review: UNNEST (and other functions) WITH ORDINALITY
Re: Review: UNNEST (and other functions) WITH ORDINALITY
List pgsql-hackers

On Mon, Aug 5, 2013 at 1:31 AM, Robert Haas <robertmhaas@gmail.com> wrote:

This looks like really nice work.

It does. It's functionally equivalent to my attempt but with much better comments and cleaner code.

But it doesn't seem to cover the case I was stumped on, namely "nulls first" appearing in a place where two unreserved keywords can appear consecutively. This doesn't happen for WITH_* before "with" is a reserved keyword.

Looking into it a bit I see that the case I was most worried about is actually a non-issue. We don't support column aliases without "AS" unless the alias is completely unknown to the parser. That seems a bit of a strange rule that must make the syntax with the missing AS pretty unreliable if people are looking for code that will continue to work in future versions. I never knew about this.

The only other case I could come up with in my regression tests is pretty esoteric:

CREATE COLLATION nulls (locale='C');
ALTER OPERATOR CLASS text_ops USING btree RENAME TO first;
CREATE TABLE nulls_first(t text);
CREATE INDEX nulls_first_i ON nulls_first(t COLLATE nulls first);

I'm not 100% sure there aren't other cases where this can occur though.

--
greg

pgsql-hackers by date:

Previous
From: "Karl O. Pinc"
Date:
Subject: Doc Patch: Subquery section to say that subqueries can't modify data
Next
From: David Johnston
Date:
Subject: Re: Doc Patch: Subquery section to say that subqueries can't modify data