v.24.10Improvement
Add show_create_query_identifier_quoting_rule for Identifier Quoting in SHOW CREATE TABLE
Addshow_create_query_identifier_quoting_ruleto define identifier quoting behavior in theSHOW CREATE TABLEquery result. Possible values: -user_display: When the identifiers is a keyword. -when_necessary: When the identifiers is one of{"distinct", "all", "table"}and when it could lead to ambiguity: column names, dictionary attribute names. -always: Always quote identifiers. #69448 (tuanpach).
Why it matters
This feature allows users to customize how identifiers are quoted in theSHOW CREATE TABLE query result, improving readability and avoiding ambiguity when dealing with keywords and special identifiers. It helps ensure that identifiers are quoted appropriately based on user preference or context, thus making the output clearer and easier to use in subsequent queries.How to use it
Users can set theshow_create_query_identifier_quoting_rule setting before running SHOW CREATE TABLE to control the quoting behavior. The possible values are:-
<code>user_display</code>: Quote identifiers only if they are SQL keywords.-
<code>when_necessary</code>: Quote identifiers if they are in {distinct, all, table} or when quoting is needed to avoid ambiguity in column names or dictionary attribute names.-
<code>always</code>: Always quote all identifiers.Example:
SET show_create_query_identifier_quoting_rule = 'when_necessary';
SHOW CREATE TABLE my_table;