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:* "]" {%
249249 })
250250% }
251251
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 ) {%
253253 // Allowing property to be <array_subscript> is currently a hack.
254254 // A better way would be to allow <property_access> on the left side of array_subscript,
255255 // 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) {
9595 second;
9696 ` ) ;
9797 } ) ;
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+ } ) ;
98113 } ) ;
99114}
You can’t perform that action at this time.
0 commit comments