@@ -52,6 +52,7 @@ pub struct ShowCreateTableInterpreter {
5252
5353pub struct ShowCreateQuerySettings {
5454 pub sql_dialect : Dialect ,
55+ pub force_quoted_ident : bool ,
5556 pub quoted_ident_case_sensitive : bool ,
5657 pub hide_options_in_show_create_table : bool ,
5758}
@@ -85,6 +86,7 @@ impl Interpreter for ShowCreateTableInterpreter {
8586
8687 let settings = ShowCreateQuerySettings {
8788 sql_dialect : settings. get_sql_dialect ( ) ?,
89+ force_quoted_ident : self . plan . with_quoted_ident ,
8890 quoted_ident_case_sensitive : settings. get_quoted_ident_case_sensitive ( ) ?,
8991 hide_options_in_show_create_table : settings
9092 . get_hide_options_in_show_create_table ( )
@@ -144,24 +146,40 @@ impl ShowCreateTableInterpreter {
144146 let field_comments = table. field_comments ( ) ;
145147 let n_fields = schema. fields ( ) . len ( ) ;
146148 let sql_dialect = settings. sql_dialect ;
149+ let force_quoted_ident = settings. force_quoted_ident ;
147150 let quoted_ident_case_sensitive = settings. quoted_ident_case_sensitive ;
148151 let hide_options_in_show_create_table = settings. hide_options_in_show_create_table ;
149152
150153 let mut table_create_sql = format ! (
151154 "CREATE TABLE {} (\n " ,
152- display_ident( name, quoted_ident_case_sensitive, sql_dialect)
155+ display_ident(
156+ name,
157+ force_quoted_ident,
158+ quoted_ident_case_sensitive,
159+ sql_dialect
160+ )
153161 ) ;
154162 if table. options ( ) . contains_key ( "TRANSIENT" ) {
155163 table_create_sql = format ! (
156164 "CREATE TRANSIENT TABLE {} (\n " ,
157- display_ident( name, quoted_ident_case_sensitive, sql_dialect)
165+ display_ident(
166+ name,
167+ force_quoted_ident,
168+ quoted_ident_case_sensitive,
169+ sql_dialect
170+ )
158171 )
159172 }
160173
161174 if table. options ( ) . contains_key ( OPT_KEY_TEMP_PREFIX ) {
162175 table_create_sql = format ! (
163176 "CREATE TEMP TABLE {} (\n " ,
164- display_ident( name, quoted_ident_case_sensitive, sql_dialect)
177+ display_ident(
178+ name,
179+ force_quoted_ident,
180+ quoted_ident_case_sensitive,
181+ sql_dialect
182+ )
165183 )
166184 }
167185
@@ -198,7 +216,12 @@ impl ShowCreateTableInterpreter {
198216 } else {
199217 "" . to_string ( )
200218 } ;
201- let ident = display_ident ( field. name ( ) , quoted_ident_case_sensitive, sql_dialect) ;
219+ let ident = display_ident (
220+ field. name ( ) ,
221+ force_quoted_ident,
222+ quoted_ident_case_sensitive,
223+ sql_dialect,
224+ ) ;
202225 let data_type = field. data_type ( ) . sql_name_explicit_null ( ) ;
203226 let column_str =
204227 format ! ( " {ident} {data_type}{default_expr}{computed_expr}{comment}" ) ;
@@ -226,7 +249,12 @@ impl ShowCreateTableInterpreter {
226249 let mut index_str = format ! (
227250 " {} INVERTED INDEX {} ({})" ,
228251 sync,
229- display_ident( & index_field. name, quoted_ident_case_sensitive, sql_dialect) ,
252+ display_ident(
253+ & index_field. name,
254+ force_quoted_ident,
255+ quoted_ident_case_sensitive,
256+ sql_dialect
257+ ) ,
230258 column_names_str
231259 ) ;
232260 if !options. is_empty ( ) {
0 commit comments