diff --git a/src/operator/src/statement/set.rs b/src/operator/src/statement/set.rs index 2b84ced3eb..b2fe29a58f 100644 --- a/src/operator/src/statement/set.rs +++ b/src/operator/src/statement/set.rs @@ -122,7 +122,11 @@ pub fn set_search_path(exprs: Vec, ctx: QueryContextRef) -> Result<()> { match search_expr { Expr::Value(Value::SingleQuotedString(search_path)) | Expr::Value(Value::DoubleQuotedString(search_path)) => { - ctx.set_current_schema(&search_path.clone()); + ctx.set_current_schema(search_path); + Ok(()) + } + Expr::Identifier(Ident { value, .. }) => { + ctx.set_current_schema(value); Ok(()) } expr => NotSupportedSnafu { diff --git a/tests/cases/standalone/common/system/pg_catalog.result b/tests/cases/standalone/common/system/pg_catalog.result index 9e154b115c..32f87fd6bd 100644 --- a/tests/cases/standalone/common/system/pg_catalog.result +++ b/tests/cases/standalone/common/system/pg_catalog.result @@ -52,6 +52,11 @@ set search_path to 'public'; Affected Rows: 0 +-- SQLNESS PROTOCOL POSTGRES +set search_path = public; + +Affected Rows: 0 + -- SQLNESS PROTOCOL POSTGRES select current_schema(); diff --git a/tests/cases/standalone/common/system/pg_catalog.sql b/tests/cases/standalone/common/system/pg_catalog.sql index 0b79c62afe..960f3cb1ff 100644 --- a/tests/cases/standalone/common/system/pg_catalog.sql +++ b/tests/cases/standalone/common/system/pg_catalog.sql @@ -20,6 +20,8 @@ set search_path to 'test'; drop database test; -- SQLNESS PROTOCOL POSTGRES set search_path to 'public'; +-- SQLNESS PROTOCOL POSTGRES +set search_path = public; -- SQLNESS PROTOCOL POSTGRES select current_schema();