s5dsn-eqee opened a new issue, #2779:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/2779

   `parse_drop` consumes `TEMPORARY` (MySQL, Generic, DuckDB) and `PERSISTENT` 
(DuckDB) before it reads the object type. Only `Statement::Drop` and `DROP 
SECRET` keep these flags. Every other branch drops them, so the statement 
parses without error but loses the keyword when printed:
   
     | Input | Dialect | Output |
     |---|---|---|
     | `DROP TEMPORARY FUNCTION f` | Generic | `DROP FUNCTION f` |
     | `DROP TEMPORARY TRIGGER tr ON t` | Generic | `DROP TRIGGER tr ON t` |
     | `DROP TEMPORARY PROCEDURE p` | Generic | `DROP PROCEDURE p` |
     | `DROP PERSISTENT TABLE t` | DuckDB | `DROP TABLE t` |
   
     The same applies to `POLICY`, `CONNECTOR`, `DOMAIN`, `EXTENSION` and 
`OPERATOR`.
   
     In most cases the input isn't valid SQL anyway, so it should fail instead 
of being accepted. `DROP TEMPORARY FUNCTION` is real syntax in 
[Spark/Databricks](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-drop-function.html)
 and Hive, so there the parser drops meaningful information.
   
     ### Expected
   
     Reject `TEMPORARY`/`PERSISTENT` for object types that don't support them, 
and keep the flag where a dialect does support it, e.g. `DROP TEMPORARY 
FUNCTION`.
   
     ### Code
   
     `src/parser/mod.rs`, `Parser::parse_drop`
   
   
   
   Spotted while reviewing #2434


-- 
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