On 8-9-2017 15:26, Dmitry Yemanov wrote:
08.09.2017 15:31, Mark Rotteveel wrote:

Isn't this all contained in the SQL specification?

Reading the spec may differ. And we don't follow the standard strictly sometimes.

3) LATERAL was historically implied for joined stored procedures, e.g.

I suggest 3b

4) LATERAL in nested parenthesis joins, e.g.

Not allowed by the syntax construction in the SQL specification:

In our parser:

%type <recSourceNode> table_primary
table_primary
     : table_proc
     | derived_table
     | '(' joined_table ')'
     ;

IMHO, it wouldn't look logical to support LATERAL for "table_proc" but disallow it for "joined table".

But LATERAL **is** a table_primary, it doesn't **use** table_primary (at least not until you dive down into the select_expr), the rule would become

%type <recSourceNode> table_primary
table_primary
    : table_proc
    | derived_table
    | lateral_derived_table
    | '(' joined_table ')'
    ;

With lateral_derived_table defined something like:

lateral_derived_table
: LATERAL '(' select_expr ')' as_noise correlation_name derived_column_list;

(or maybe simply with production: LATERAL derived_table)

Note that this may be an indication that I need to revise my opinion on point 3 though.

Mark
--
Mark Rotteveel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to