You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2023/03/24 20:56:00 UTC

[jira] [Comment Edited] (CALCITE-5403) Babel parser should parse PostgreSQL's SET, RESET, BEGIN, SHOW, ROLLBACK, COMMIT commands

    [ https://issues.apache.org/jira/browse/CALCITE-5403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17704807#comment-17704807 ] 

Julian Hyde edited comment on CALCITE-5403 at 3/24/23 8:55 PM:
---------------------------------------------------------------

* The indentation of the .ftl is all over the place (1, 2, 4 spaces used in various places). Can you make it consistent with other parser code in Calcite?
* Javadoc comments need to be valid HTML (use {{<p>}}, {{<pre>}} to control line wrapping, and do not use raw {{<}} and {{>}})
* I would use 'postgres' rather than 'postgresql' as a package name. (Yeah, not consistent with the rest of Calcite. But 'PostgreSQL' is impossible to say, and becomes meaningless much when you combine it into an identifier like {{PostgresqlSqlShow}}.)
* {{AndChain}} isn't a good name. I thought it was a chain of AND operators. Can you find another one.
* Having a subclass of {{SqlSpecialOperator}} for every kind of Ast node is a pattern that we need to stop doing. Can you find a way to do this using {{SqlBasicOperator}} or similar?


was (Author: julianhyde):
* The indentation of the .ftl is all over the place (1, 2, 4 spaces used in various places). Can you make it consistent with other parser code in Calcite?
* Javadoc comments need to be valid HTML (use `<p>`, `<pre>` to control line wrapping, and do not use raw `<` and `>`)
* I would use 'postgres' rather than 'postgresql' as a package name. (Yeah, not consistent with the rest of Calcite. But 'PostgreSQL' is impossible to say, and becomes meaningless much when you combine it into an identifier like `PostgresqlSqlShow`.
* {{AndChain}} isn't a good name. I thought it was a chain of AND operators. Can you find another one.
* 
* Having a subclass of {{SqlSpecialOperator}} for every kind of Ast node is a pattern that we need to stop doing. Can you find a way to do this using {{SqlBasicOperator}} or similar?

> Babel parser should parse PostgreSQL's SET, RESET, BEGIN, SHOW, ROLLBACK, COMMIT commands
> -----------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5403
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5403
>             Project: Calcite
>          Issue Type: Bug
>          Components: babel
>    Affects Versions: 1.34.0
>            Reporter: Dmitry Sysolyatin
>            Assignee: Dmitry Sysolyatin
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.35.0
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Babel parser can not parse BEGIN [1], SHOW [2], ROLLBACK [3], COMMIT [4] commands at the moment.
> It can parse SET [5] and RESET [6], but not completely. For instance, it can not parse the following statement:
> {code:java}
> SET SCHEMA public,public,"$user"
> {code}
> The syntax for these commands is as follows:
>  * BEGIN [1]:
> {code:java}
> BEGIN [ WORK | TRANSACTION ] [ transaction_mode [, ...] ] 
> where transaction_mode is one of: ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED } READ WRITE | READ ONLY [ NOT ] DEFERRABLE
> {code}
>  * SHOW [2]:
> {code:java}
> SHOW (<TRANSACTION ISOLATION LEVEL> | <string literal>)
> {code}
>  * ROLLBACK [3]:
> {code:java}
> ROLLBACK [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
> {code}
>  * COMMIT [4]:
> {code:java}
> COMMIT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
> {code}
>  * SET [5]
> {code:java}
> SET [ SESSION | LOCAL ] configuration_parameter { TO | = } { value | 'value' | DEFAULT }
> SET [ SESSION | LOCAL ] TIME ZONE { value | 'value' | LOCAL | DEFAULT }
> SET [ SESSION | LOCAL ]  { SCHEMA | SEED | NAMES } value
> Values can be specified as string constants, identifiers, numbers, or comma-separated lists of these
> {code}
>  * RESET [6]
> {code:java}
> RESET <parameter>;
> {code}
> [1] [https://www.postgresql.org/docs/current/sql-begin.html]
> [2] [https://www.postgresql.org/docs/current/sql-show.html]
> [3] [https://www.postgresql.org/docs/current/sql-rollback.html]
> [4] [https://www.postgresql.org/docs/current/sql-commit.html]
> [5] [https://www.postgresql.org/docs/current/sql-set.html]
> [6] [https://www.postgresql.org/docs/current/sql-reset.html]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)