Skip to content

KIKIMR-20931: Fix set_config #1521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions ydb/library/yql/sql/pg/pg_sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" && rawStr != "information_schema") {
AddError(TStringBuilder() << "VariableSetStmt, search path supports only 'information_schema', 'public', 'pg_catalog', '' but got: '" << rawStr << "'");
return nullptr;
}
if (Settings.GUCSettings) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down