Re: AS OF queries - Mailing list pgsql-hackers

From Tom Lane
Subject Re: AS OF queries
Date
Msg-id 11551.1513783754@sss.pgh.pa.us
Whole thread Raw
In response to Re: AS OF queries  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: AS OF queries
List pgsql-hackers
Laurenz Albe <laurenz.albe@cybertec.at> writes:
> Konstantin Knizhnik wrote:
>> I failed to support AS OF clause (as in Oracle) because of shift-reduce 
>> conflicts with aliases,
>> so I have to introduce new ASOF keyword. May be yacc experts can propose 
>> how to solve this conflict without introducing new keyword...

> I think it would be highly desirable to have AS OF, because that's
> the way the SQL standard has it.

Please say that's just an Oracle-ism and not SQL standard, because it's
formally ambiguous.  This is required to work by spec:

regression=# select x as of from (values(1)) t(x);
 of 
----
  1
(1 row)

so it's not possible for us ever to support an expression that includes
top-level "AS OF" (or, pretty much, "AS anything") without some rather
enormous pushups.

If we absolutely had to do it, the path to a solution would involve some
lexer-level lookahead, cf base_yylex() --- but that's messy and tends to
introduce its own set of corner case misbehaviors.  I'd much rather use a
syntax that wasn't chosen with blind disregard for SQL's existing
syntactic constraints.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] replace GrantObjectType with ObjectType
Next
From: Tom Lane
Date:
Subject: Re: pltcl valgrind output