Peter Toth created SPARK-57960:
----------------------------------

             Summary: Escape table and schema identifiers in JDBC dialect index 
metadata queries
                 Key: SPARK-57960
                 URL: https://issues.apache.org/jira/browse/SPARK-57960
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Peter Toth


PostgresDialect.indexExists and H2Dialect.indexExists/listIndexes embed the 
table (and, for H2, schema) name into a SQL string literal in the pg_indexes / 
INFORMATION_SCHEMA lookup query without escaping. A table or schema name 
containing a single quote therefore produces a malformed query that fails with 
a syntax error. This is inconsistent with the index name in the same methods, 
which is already escaped via escapeSql (SPARK-57446 / SPARK-57447).

Fix: apply escapeSql to the table/schema identifiers at these sites so 
quote-containing identifiers work correctly. (MySQLDialect.indexExists places 
the table in identifier position via quoteIdentifier and is already correct.)




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to