Re: Recursive query syntax ambiguity
От | Gregory Stark |
---|---|
Тема | Re: Recursive query syntax ambiguity |
Дата | |
Msg-id | 87ac05a686.fsf@stark.xeocode.com обсуждение исходный текст |
Ответ на | Re: Recursive query syntax ambiguity (Andrew Dunstan <andrew@dunslane.net>) |
Ответы |
Re: Recursive query syntax ambiguity
|
Список | pgsql-hackers |
"Andrew Dunstan" <andrew@dunslane.net> writes: > Can you post the rules you have so far that you're playing around with? (Also > maybe the rules from the standard - I don't have a copy handy). This is the best compromise I've come up with so far. It makes CYCLE a reserved word and requires a CYCLE clause if there's a SEARCH clause. Here are the grammar rules from the spec (I've attached PDFs of the syntax pages for the two productions I'm describing since the text copy/paste comes out pretty poorly) 7.13 <query expression> Function Specify a table. Format <query expression> ::= [ <with clause> ] <query expression body> <with clause> ::= WITH [ RECURSIVE ] <with list> <with list> ::= <with list element> [ { <comma> <with list element> }... ] <with list element> ::= <query name> [ <left paren> <with column list> <right paren> ] AS <left paren> <query expression> <right paren> [ <search or cycle clause> ] <with column list> ::= <column name list> <query expression body> ::= <query term> | <query expression body> UNION [ ALL | DISTINCT ] [ <corresponding spec> ] <query term> | <query expression body> EXCEPT [ ALL | DISTINCT ] [ <corresponding spec> ] <query term> <query term> ::= <query primary> | <query term> INTERSECT [ ALL | DISTINCT ] [ <corresponding spec> ] <query primary> <query primary> ::= <simple table> | <left paren> <query expression body> <right paren> <simple table> ::= <query specification> | <table value constructor> | <explicit table> <explicit table> ::= TABLE <table or query name> <corresponding spec> ::= CORRESPONDING [ BY <left paren> <corresponding column list> <right paren> ] <corresponding column list> ::= <column name list> 7.14 <search or cycle clause> Function Specify the generation of ordering and cycle detection information in the result of recursive query expressions. Format <search or cycle clause> ::= <search clause> | <cycle clause> | <search clause> <cycle clause> <search clause> ::= SEARCH <recursive search order> SET <sequence column> <recursive search order> ::= DEPTH FIRST BY <sort specification list> | BREADTH FIRST BY <sort specification list> <sequence column> ::= <column name> <cycle clause> ::= CYCLE <cycle column list> SET <cycle mark column> TO <cycle mark value> DEFAULT <non-cycle mark value> USING <path column> <cycle column list> ::= <cycle column> [ { <comma> <cycle column> }... ] <cycle column> ::= <column name> <cycle mark column> ::= <column name> <path column> ::= <column name> <cycle mark value> ::= <value expression> <non-cycle mark value> ::= <value expression> -- Gregory Stark EnterpriseDB http://www.enterprisedb.com
Вложения
В списке pgsql-hackers по дате отправления: