LucaCappelletti94 opened a new pull request, #2540:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2540

   This PR changes `Table` fields from `Option<String>` to `Option<Ident>` and 
updates [`TABLE` 
command](https://www.postgresql.org/docs/current/sql-select.html#SQL-TABLE) 
parsing to preserve identifier quoting and stop eagerly consuming trailing 
tokens.
   
   Previously, `parse_as_table` discarded quote styles on table identifiers and 
unconditionally called `next_token()` three times, breaking roundtripping and 
trailing clauses:
   
   ```sql
   -- Quoted table names had quotes stripped on display, breaking re-parse:
   CREATE TABLE t AS TABLE `%mpty`;
   -- Displayed as:  CREATE TABLE t AS TABLE %mpty
   -- Re-parse error: ParserError("Expected: Table name, found: % at Line: 1, 
Column: 25")
   
   -- Trailing clauses were swallowed:
   CREATE TABLE t AS TABLE old_table ORDER BY x;
   -- Parse error: ParserError("Expected: end of statement, found: x")


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to