You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Quoted schema and table names appear double-quoted in the query plan.
Reproduction
My types of SQL statements are affected, CREATE SCHEMA is just one example:
let sql = "CREATE SCHEMA \"quoted_schema_name\"";let plan = logical_plan(sql).unwrap();assert_eq!(format!("{plan:?}"),"CREATE SCHEMA \"\"quoted_schema_name\"\"");
Expected behavior
Quoted identifiers should remain single-quoted (or possibly unquoted if they contain no special characters).
Root cause
The sqlparser create uses ast::Ident (often packaged as ast::ObjectName's) to store identifiers such as table, schema, and column names. Ident stores the actualy identifier in its value field, plus an optional quote character in quoting_style. Ident::to_string() applies the quotes when quoteing_style is not None. The result of Ident::to_string() is once-again quoted by datafusion. For non-quoted identifiers only the second quoting is applied, masking the bug.
Since datafusion does it's own quoting, Ident::to_string() calls should be replaced by ident.value.
Description
Quoted schema and table names appear double-quoted in the query plan.
Reproduction
My types of SQL statements are affected,
CREATE SCHEMA
is just one example:Expected behavior
Quoted identifiers should remain single-quoted (or possibly unquoted if they contain no special characters).
Root cause
The
sqlparser
create usesast::Ident
(often packaged asast::ObjectName
's) to store identifiers such as table, schema, and column names.Ident
stores the actualy identifier in itsvalue
field, plus an optional quote character inquoting_style
.Ident::to_string()
applies the quotes whenquoteing_style
is notNone
. The result ofIdent::to_string()
is once-again quoted by datafusion. For non-quoted identifiers only the second quoting is applied, masking the bug.Since datafusion does it's own quoting,
Ident::to_string()
calls should be replaced byident.value
.Example occurance:
Ident::toString()
usage forCREATE SCHEMA
The text was updated successfully, but these errors were encountered: