What would you expect this query to return? You haven't specified a FROM
clause, so there's no indication where "language" should come from.

--
Michael Mior
mm...@apache.org


Le mer. 23 mars 2022 à 14:02, Adolfo Ochagavía <ado...@ochagavia.nl> a
écrit :

> Hi there,
>
> I am trying to find my way using Calcite to parse SQL queries, and was
> surprised to find out that parsing the query "SELECT language" fails with
> an exception.
>
> This is the code:
> > var config = SqlParser.Config.DEFAULT.withLex(Lex.MYSQL);
> > var parser = SqlParser.create("SELECT language", config);
> > var parsed = parser.parseQuery();
>
> This is the exception:
> > org.apache.calcite.sql.parser.SqlParseException: Encountered ".
> language" at line 1, column 18.
> > Was expecting one of:
> >     <EOF>
> >     "AS" ...
> >     [the rest is omitted for brevity, but about 60 more lines follow]
>
> Am I missing something or is this a bug? Note that the query is a
> simplified excerpt of an autoconfiguration query issued by MySQL's JDBC
> driver and seems to be handled well by MySQL servers. Below I am pasting
> the full query, in case someone would like to see the original:
> > /* mysql-connector-java-8.0.19 (Revision:
> a0ca826f5cdf51a98356fdfb1bf251eb042f80bf) */SELECT
> @@session.auto_increment_increment AS auto_increment_increment,
> @@character_set_client AS character_set_client,
> @@character_set_connection AS character_set_connection,
> @@character_set_results AS character_set_results,
> @@character_set_server AS character_set_server, @@collation_server AS
> collation_server, @@collation_connection AS collation_connection,
> @@init_connect AS init_connect, @@interactive_timeout AS
> interactive_timeout, @@language AS language, @@license AS license,
> @@lower_case_table_names AS lower_case_table_names,
> @@max_allowed_packet AS max_allowed_packet, @@net_write_timeout AS
> net_write_timeout, @@performance_schema AS performance_schema,
> @@query_cache_size AS query_cache_size, @@query_cache_type AS
> query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS
> system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS
> transaction_isolation, @@wait_timeout AS wait_timeout
>
> Thanks for helping out ;)
> Adolfo

Reply via email to