File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ square_brackets -> "[" free_form_sql:* "]" {%
249
249
})
250
250
% }
251
251
252
- property_access - > atomic_expression _ % DOT _ (identifier | array_subscript | all_columns_asterisk ) {%
252
+ property_access - > atomic_expression _ % DOT _ (identifier | array_subscript | all_columns_asterisk | parameter ) {%
253
253
// Allowing property to be <array_subscript> is currently a hack.
254
254
// A better way would be to allow <property_access> on the left side of array_subscript,
255
255
// but we currently can't do that because of another hack that requires
Original file line number Diff line number Diff line change @@ -95,5 +95,20 @@ export default function supportsParamTypes(format: FormatFn) {
95
95
second;
96
96
` ) ;
97
97
} ) ;
98
+
99
+ // Normal SQL prepared statement parameters cannot really occur like this,
100
+ // but we support this to facilitate using the paramTypes config for
101
+ // working around SQL templating.
102
+ it ( 'supports parameterizing schema.table.column syntax' , ( ) => {
103
+ const result = format ( 'SELECT {schema}.{table}.{column} FROM {schema}.{table}' , {
104
+ paramTypes : { custom : [ { regex : String . raw `\{\w+\}` } ] } ,
105
+ } ) ;
106
+ expect ( result ) . toBe ( dedent `
107
+ SELECT
108
+ {schema}.{table}.{column}
109
+ FROM
110
+ {schema}.{table}
111
+ ` ) ;
112
+ } ) ;
98
113
} ) ;
99
114
}
You can’t perform that action at this time.
0 commit comments