From bc179d890d28f51f517ac2b7430fb9b7ddb755c2 Mon Sep 17 00:00:00 2001 From: MrLolthe1st Date: Thu, 1 Feb 2024 14:08:57 +0000 Subject: [PATCH 1/3] KIKIMR-20931: Fix set_config --- ydb/library/yql/sql/pg/pg_sql.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ydb/library/yql/sql/pg/pg_sql.cpp b/ydb/library/yql/sql/pg/pg_sql.cpp index 723b77ab518d..8f054923b74f 100644 --- a/ydb/library/yql/sql/pg/pg_sql.cpp +++ b/ydb/library/yql/sql/pg/pg_sql.cpp @@ -2091,8 +2091,8 @@ class TConverter : public IPGParseEvents { AddError(TStringBuilder() << "VariableSetStmt, set_config doesn't support that option:" << name); return nullptr; } - if (rawStr != "pg_catalog" && rawStr != "public") { - AddError(TStringBuilder() << "VariableSetStmt, search path supports only public and pg_catalogue, but got :" << rawStr); + if (rawStr != "pg_catalog" && rawStr != "public" && rawStr != "") { + AddError(TStringBuilder() << "VariableSetStmt, search path supports only 'public', 'pg_catalogue', '' but got: '" << rawStr << "'"); return nullptr; } if (Settings.GUCSettings) { @@ -2382,12 +2382,16 @@ class TConverter : public IPGParseEvents { case TRANS_STMT_COMMIT: Statements.push_back(L(A("let"), A("world"), L(A("CommitAll!"), A("world")))); - Settings.GUCSettings->Commit(); + if (Settings.GUCSettings) { + Settings.GUCSettings->Commit(); + } return true; case TRANS_STMT_ROLLBACK: Statements.push_back(L(A("let"), A("world"), L(A("CommitAll!"), A("world"), QL(QL(QA("mode"), QA("rollback")))))); - Settings.GUCSettings->RollBack(); + if (Settings.GUCSettings) { + Settings.GUCSettings->RollBack(); + } return true; default: AddError(TStringBuilder() << "TransactionStmt: kind is not supported: " << (int)value->kind); @@ -2526,7 +2530,7 @@ class TConverter : public IPGParseEvents { } if (schemaname == "" && Settings.GUCSettings) { auto search_path = Settings.GUCSettings->Get("search_path"); - if (!search_path || *search_path == "public") { + if (!search_path || *search_path == "public" || search_path->empty()) { return Settings.DefaultCluster; } return TString(*search_path); From f999a9f9f99f09f4e159b8e69c820eec35a2f40e Mon Sep 17 00:00:00 2001 From: MrLolthe1st Date: Thu, 1 Feb 2024 14:35:50 +0000 Subject: [PATCH 2/3] typo --- ydb/library/yql/sql/pg/pg_sql.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ydb/library/yql/sql/pg/pg_sql.cpp b/ydb/library/yql/sql/pg/pg_sql.cpp index 8f054923b74f..29a65564b08b 100644 --- a/ydb/library/yql/sql/pg/pg_sql.cpp +++ b/ydb/library/yql/sql/pg/pg_sql.cpp @@ -2092,7 +2092,7 @@ class TConverter : public IPGParseEvents { return nullptr; } if (rawStr != "pg_catalog" && rawStr != "public" && rawStr != "") { - AddError(TStringBuilder() << "VariableSetStmt, search path supports only 'public', 'pg_catalogue', '' but got: '" << rawStr << "'"); + AddError(TStringBuilder() << "VariableSetStmt, search path supports only 'public', 'pg_catalog', '' but got: '" << rawStr << "'"); return nullptr; } if (Settings.GUCSettings) { From 90a87eee25948c0d57e35457109bd94f03dc24ae Mon Sep 17 00:00:00 2001 From: MrLolthe1st Date: Thu, 1 Feb 2024 15:05:13 +0000 Subject: [PATCH 3/3] add information_schema --- ydb/library/yql/sql/pg/pg_sql.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ydb/library/yql/sql/pg/pg_sql.cpp b/ydb/library/yql/sql/pg/pg_sql.cpp index 29a65564b08b..c7b5b8a2fc29 100644 --- a/ydb/library/yql/sql/pg/pg_sql.cpp +++ b/ydb/library/yql/sql/pg/pg_sql.cpp @@ -2091,8 +2091,8 @@ class TConverter : public IPGParseEvents { AddError(TStringBuilder() << "VariableSetStmt, set_config doesn't support that option:" << name); return nullptr; } - if (rawStr != "pg_catalog" && rawStr != "public" && rawStr != "") { - AddError(TStringBuilder() << "VariableSetStmt, search path supports only 'public', 'pg_catalog', '' but got: '" << rawStr << "'"); + if (rawStr != "pg_catalog" && rawStr != "public" && rawStr != "" && rawStr != "information_schema") { + AddError(TStringBuilder() << "VariableSetStmt, search path supports only 'information_schema', 'public', 'pg_catalog', '' but got: '" << rawStr << "'"); return nullptr; } if (Settings.GUCSettings) {