diff options
author | shumkovnd <shumkovnd@yandex-team.com> | 2024-11-12 21:40:16 +0300 |
---|---|---|
committer | shumkovnd <shumkovnd@yandex-team.com> | 2024-11-12 21:51:13 +0300 |
commit | 19054bfe016994535e85c842853969907ecff0d1 (patch) | |
tree | 6fdca9240b42f2a5ab93751d143f0346be6a7f89 /yql/essentials | |
parent | a28fc12c9dc3aac2edd056b9f6d70087dbfd0e48 (diff) | |
download | ydb-19054bfe016994535e85c842853969907ecff0d1.tar.gz |
Support alter sequence restart with in pg
<https://github.com/ydb-platform/ydb/issues/11475>
commit_hash:4db52ba0a2da92d383d7269cdb2e13d5a552b30a
Diffstat (limited to 'yql/essentials')
-rw-r--r-- | yql/essentials/providers/common/provider/yql_provider.cpp | 2 | ||||
-rw-r--r-- | yql/essentials/sql/pg/pg_sql.cpp | 4 | ||||
-rw-r--r-- | yql/essentials/sql/pg/pg_sql_ut.cpp | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/yql/essentials/providers/common/provider/yql_provider.cpp b/yql/essentials/providers/common/provider/yql_provider.cpp index 268c95caba..ec2c3ca57c 100644 --- a/yql/essentials/providers/common/provider/yql_provider.cpp +++ b/yql/essentials/providers/common/provider/yql_provider.cpp @@ -408,7 +408,7 @@ TWriteSequenceSettings ParseSequenceSettings(NNodes::TExprList node, TExprContex TVector<TCoNameValueTuple> other; const static std::unordered_set<TString> sequenceSettingNames = - {"start", "increment", "cache", "minvalue", "maxvalue", "cycle"}; + {"start", "increment", "cache", "minvalue", "maxvalue", "cycle", "restart"}; for (auto child : node) { if (auto maybeTuple = child.Maybe<TCoNameValueTuple>()) { diff --git a/yql/essentials/sql/pg/pg_sql.cpp b/yql/essentials/sql/pg/pg_sql.cpp index fb69420d49..94f90ff39e 100644 --- a/yql/essentials/sql/pg/pg_sql.cpp +++ b/yql/essentials/sql/pg/pg_sql.cpp @@ -2946,6 +2946,10 @@ public: NodeNotImplemented(defElem->arg); return nullptr; } + } else { + if (nameElem == "restart") { + options.emplace_back(QL(QAX(nameElem), QA(TString()))); + } } break; } diff --git a/yql/essentials/sql/pg/pg_sql_ut.cpp b/yql/essentials/sql/pg/pg_sql_ut.cpp index 99bab17967..6ff55df776 100644 --- a/yql/essentials/sql/pg/pg_sql_ut.cpp +++ b/yql/essentials/sql/pg/pg_sql_ut.cpp @@ -301,14 +301,14 @@ Y_UNIT_TEST_SUITE(PgSqlParsingOnly) { } Y_UNIT_TEST(AlterSequenceStmt) { - auto res = PgSqlToYql("ALTER SEQUENCE IF EXISTS seq AS integer START WITH 10 INCREMENT BY 2 NO MINVALUE NO MAXVALUE CACHE 3;"); + auto res = PgSqlToYql("ALTER SEQUENCE IF EXISTS seq AS integer START WITH 10 RESTART WITH 101 INCREMENT BY 2 NO MINVALUE NO MAXVALUE CACHE 3;"); UNIT_ASSERT_C(res.Root, res.Issues.ToString()); TString program = R"( ( (let world (Configure! world (DataSource 'config) 'OrderedColumns)) (let world (Write! world (DataSink '"kikimr" '"") (Key '('pgObject (String '"seq") (String 'pgSequence))) - (Void) '('('mode 'alter_if_exists) '('"as" '"int4") '('"start" '10) '('"increment" '2) '('"cache" '3)))) + (Void) '('('mode 'alter_if_exists) '('"as" '"int4") '('"start" '10) '('"restart" '101) '('"increment" '2) '('"cache" '3)))) (let world (CommitAll! world)) (return world) ) )"; |