Quoting reserved words in column names
Learn about how Impala handles column name projection for JDBC external table names to support reserved words and case sensitivity.
When you generate SQL queries for JDBC external table names, Impala explicitly quotes all projected column names. This ensures that column names that are also reserved keywords in the source database do not cause query failures.
The quote characters used depend on the specific JDBC driver:
- Backticks (`) are used for Hive, Impala, and MySQL drivers.
- Double quotes (") are used for all other supported database drivers.
By using these quote characters, you can use case-sensitive names or reserved words as column identifiers. For example, if a table contains a column named freeze (a reserved word), you can find null values by running the following query:
SELECT id, name, date_col FROM quoted_col WHERE freeze IS NULL;
