Skip to content

Commit 7f64b2d

Browse files
authored
Add EnablePgSyntax flag (#8703)
1 parent 16530db commit 7f64b2d

File tree

13 files changed

+32
-4
lines changed

13 files changed

+32
-4
lines changed

ydb/core/kqp/compile_service/kqp_compile_actor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ class TKqpCompileActor : public TActorBootstrapped<TKqpCompileActor> {
146146
.SetIsEnableExternalDataSources(AppData(ctx)->FeatureFlags.GetEnableExternalDataSources())
147147
.SetIsEnablePgConstsToParams(Config->EnablePgConstsToParams)
148148
.SetApplicationName(ApplicationName)
149-
.SetQueryParameters(QueryId.QueryParameterTypes);
149+
.SetQueryParameters(QueryId.QueryParameterTypes)
150+
.SetIsEnablePgSyntax(AppData(ctx)->FeatureFlags.GetEnablePgSyntax());
150151

151152
return ParseStatements(QueryId.Text, QueryId.Settings.Syntax, QueryId.IsSql(), settingsBuilder, PerStatementResult);
152153
}

ydb/core/kqp/host/kqp_host.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,8 @@ class TKqpHost : public IKqpHost {
12281228
.SetIsEnableExternalDataSources(SessionCtx->Config().FeatureFlags.GetEnableExternalDataSources())
12291229
.SetIsEnablePgConstsToParams(SessionCtx->Config().EnablePgConstsToParams)
12301230
.SetQueryParameters(query.ParameterTypes)
1231-
.SetApplicationName(ApplicationName);
1231+
.SetApplicationName(ApplicationName)
1232+
.SetIsEnablePgSyntax(SessionCtx->Config().FeatureFlags.GetEnablePgSyntax());
12321233
auto astRes = ParseQuery(query.Text, isSql, sqlVersion, TypesCtx->DeprecatedSQL, ctx, settingsBuilder, result.KeepInCache, result.CommandTagName);
12331234
if (astRes.ActualSyntaxType == NYql::ESyntaxType::Pg) {
12341235
SessionCtx->Config().IndexAutoChooserMode = NKikimrConfig::TTableServiceConfig_EIndexAutoChooseMode::TTableServiceConfig_EIndexAutoChooseMode_MAX_USED_PREFIX;

ydb/core/kqp/host/kqp_translate.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ NSQLTranslation::TTranslationSettings TKqpTranslationSettingsBuilder::Build(NYql
8686
settings.SaveWorldDependencies = true;
8787
}
8888

89+
settings.PGDisable = !IsEnablePgSyntax;
8990
settings.InferSyntaxVersion = true;
9091
settings.V0ForceDisable = false;
9192
settings.WarnOnV0 = false;

ydb/core/kqp/host/kqp_translate.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ class TKqpTranslationSettingsBuilder {
6262
return *this;
6363
}
6464

65+
TKqpTranslationSettingsBuilder& SetIsEnablePgSyntax(bool value) {
66+
IsEnablePgSyntax = value;
67+
return *this;
68+
}
69+
6570
private:
6671
const NYql::EKikimrQueryType QueryType;
6772
const ui16 KqpYqlSyntaxVersion;
@@ -73,6 +78,7 @@ class TKqpTranslationSettingsBuilder {
7378
TString KqpTablePathPrefix = {};
7479
bool IsEnableExternalDataSources = false;
7580
bool IsEnablePgConstsToParams = false;
81+
bool IsEnablePgSyntax = false;
7682
TMaybe<bool> SqlAutoCommit = {};
7783
TGUCSettings::TPtr GUCSettings;
7884
TMaybe<TString> ApplicationName = {};

ydb/core/kqp/ut/common/kqp_ut_common.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ TKikimrRunner::TKikimrRunner(const TKikimrSettings& settings) {
132132
ServerSettings->SetEnableMoveIndex(true);
133133
ServerSettings->SetUseRealThreads(settings.UseRealThreads);
134134
ServerSettings->SetEnableTablePgTypes(true);
135+
ServerSettings->SetEnablePgSyntax(true);
135136
ServerSettings->S3ActorsFactory = settings.S3ActorsFactory;
136137

137138
if (settings.Storage) {

ydb/core/kqp/ut/pg/kqp_pg_ut.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4801,7 +4801,8 @@ Y_UNIT_TEST_SUITE(KqpPg) {
48014801
ui16 mbusport = tp.GetPort(2134);
48024802
auto settings = Tests::TServerSettings(mbusport)
48034803
.SetDomainName("Root")
4804-
.SetUseRealThreads(false);
4804+
.SetUseRealThreads(false)
4805+
.SetEnablePgSyntax(true);
48054806

48064807
Tests::TServer::TPtr server = new Tests::TServer(settings);
48074808

ydb/core/protos/feature_flags.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,5 @@ message TFeatureFlags {
155155
optional bool EnableOptionalColumnsInColumnShard = 136 [default = false];
156156
optional bool EnableGranularTimecast = 137 [default = true];
157157
optional bool EnableAlterShardingInColumnShard = 138 [default = false];
158+
optional bool EnablePgSyntax = 139 [default = true];
158159
}

ydb/core/testlib/basics/feature_flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class TTestFeatureFlagsHolder {
6464
FEATURE_FLAG_SETTER(EnableChangefeedsOnIndexTables)
6565
FEATURE_FLAG_SETTER(EnableBackupService)
6666
FEATURE_FLAG_SETTER(EnableGranularTimecast)
67+
FEATURE_FLAG_SETTER(EnablePgSyntax)
6768

6869
#undef FEATURE_FLAG_SETTER
6970
};

ydb/library/yql/sql/settings/translation_settings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ namespace NSQLTranslation {
5858
, InferSyntaxVersion(false)
5959
, V0Behavior(EV0Behavior::Disable)
6060
, V0ForceDisable(InTestEnvironment())
61+
, PGDisable(false)
6162
, WarnOnV0(true)
6263
, V0WarnAsError(ISqlFeaturePolicy::MakeAlwaysDisallow())
6364
, DqDefaultAuto(ISqlFeaturePolicy::MakeAlwaysDisallow())

ydb/library/yql/sql/settings/translation_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ namespace NSQLTranslation {
106106
bool InferSyntaxVersion;
107107
EV0Behavior V0Behavior;
108108
bool V0ForceDisable;
109+
bool PGDisable;
109110
bool WarnOnV0;
110111
ISqlFeaturePolicy::TPtr V0WarnAsError;
111112
ISqlFeaturePolicy::TPtr DqDefaultAuto;

0 commit comments

Comments
 (0)