apache / datafusion-sqlparser-rs

Extensible SQL Lexer and Parser for Rust
Apache License 2.0
2.73k stars 517 forks source link

`SHOW FUNCTIONS` allowed syntax does not match source/intent #1399

Open findepi opened 1 month ago

findepi commented 1 month ago

SHOW FUNCTIONS https://github.com/sqlparser-rs/sqlparser-rs/blob/7282ce22f9f031a2c9fd5831427f01f2f0dbb978/src/ast/mod.rs#L2450-L2453

it allow syntax

SHOW FUNCTIONS
SHOW FUNCTIONS LIKE 'pattern'
SHOW FUNCTIONS ILIKE 'pattern' 
SHOW FUNCTIONS WHERE <expr>

however, it's also documented to match Presto's SHOW FUNCTIONS which doesn't allow ILIKE nor WHERE (and wouldn't know how the WHERE should be applied) https://prestodb.io/docs/current/sql/show-functions.html

worth noting that Trino's SHOW FUNCTIONS is similar, but allows additional schema filter https://trino.io/docs/current/sql/show-functions.html

findepi commented 1 month ago

My read on this is that this is a editorial mistake. ShowStatementFilter would be suitable for SHOW FUNCTION STATUS statement (MySQL-specific). If we want to have Presto/Trino-specific SHOW FUNCTIONS, should we drop syntax that neither of them supports?

alamb commented 3 weeks ago

Possibly related: https://github.com/sqlparser-rs/sqlparser-rs?tab=readme-ov-file#syntax-vs-semantics

alamb commented 3 weeks ago

I think changing the parser support to mroe accurately reflect different dialects makes sense to me