@@ -213,7 +213,7 @@ export class AbstractSQLClient extends AbstractClient {
213213 } ;
214214
215215 break ;
216-
216+
217217 default : throw new Error ( `Invalid query input` ) ;
218218 }
219219
@@ -270,13 +270,22 @@ export class AbstractSQLClient extends AbstractClient {
270270 // Parsing...
271271 if ( ! ( query instanceof AbstractNode ) ) {
272272 query = await this . parse ( query , options ) ;
273- } else if ( ! ( query instanceof registry . Script ) && ! ( query instanceof AbstractStmt ) ) {
273+ } else if ( ! ( query instanceof registry . Script )
274+ && ! ( query instanceof AbstractStmt )
275+ && ! ( query instanceof registry . MYSetStmt )
276+ && ! ( query instanceof registry . PGSetStmt ) ) {
274277 throw new TypeError ( 'query must be a string or an instance of Script | AbstractStmt' ) ;
275278 }
276279 if ( query instanceof registry . Script && query . length === 1 ) {
277280 query = query . entries ( ) [ 0 ] ;
278281 }
279282
283+ // Return if query is a set statement or a standard statement
284+ if ( query instanceof registry . MYSetStmt
285+ || query instanceof registry . PGSetStmt
286+ || query instanceof registry . StdStmt
287+ ) return query ;
288+
280289 // Determine by heuristics if desugaring needed
281290 if ( ( query instanceof registry . DDLStmt && ! query . returningClause ?. ( ) ) // Desugaring not applicable
282291 || query . originSchemas ?. ( ) ?. length // Desugaring already done
@@ -286,6 +295,10 @@ export class AbstractSQLClient extends AbstractClient {
286295 const relationSelector = { } ;
287296 let anyFound = false ;
288297 query . walkTree ( ( v , k , scope ) => {
298+ if ( v instanceof registry . MYSetStmt
299+ || v instanceof registry . PGSetStmt
300+ || v instanceof registry . StdStmt
301+ ) return ;
289302 if ( v instanceof registry . DDLStmt
290303 && ! v . returningClause ?. ( ) ) return ;
291304 if ( v instanceof registry . CTEItem ) {
0 commit comments