aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvvvv <vvvv@ydb.tech>2023-12-06 19:23:03 +0300
committervvvv <vvvv@ydb.tech>2023-12-06 21:39:10 +0300
commitc05ebc290f4d21309d2735065c428bea6bcb7183 (patch)
treea7d3353836c4e873eeed1eba1410068dffbf69dd
parentd5ed366302681e174e0417923a299b6744627933 (diff)
downloadydb-c05ebc290f4d21309d2735065c428bea6bcb7183.tar.gz
YQL-17038 [pg] ignore locking clause for now
-rw-r--r--ydb/library/yql/core/issue/protos/issue_id.proto3
-rw-r--r--ydb/library/yql/core/issue/yql_issue.txt4
-rw-r--r--ydb/library/yql/sql/pg/pg_sql.cpp10
-rw-r--r--ydb/library/yql/sql/pg/pg_sql_ut.cpp11
4 files changed, 20 insertions, 8 deletions
diff --git a/ydb/library/yql/core/issue/protos/issue_id.proto b/ydb/library/yql/core/issue/protos/issue_id.proto
index 9501ade665..c8ecb8f7ae 100644
--- a/ydb/library/yql/core/issue/protos/issue_id.proto
+++ b/ydb/library/yql/core/issue/protos/issue_id.proto
@@ -181,6 +181,9 @@ message TIssuesIds {
DQ_GATEWAY_NEED_FALLBACK_ERROR = 6001;
DQ_OPTIMIZE_ERROR = 6002;
+// pg
+ PG_NO_LOCKING_SUPPORT = 7000;
+
// range [200000, 399999) reserved for KiKiMR issue codes, do not use!
}
diff --git a/ydb/library/yql/core/issue/yql_issue.txt b/ydb/library/yql/core/issue/yql_issue.txt
index 1079e4237d..a46832511d 100644
--- a/ydb/library/yql/core/issue/yql_issue.txt
+++ b/ydb/library/yql/core/issue/yql_issue.txt
@@ -643,3 +643,7 @@ ids {
code: YQL_HINT_INVALID_PARAMETERS
severity: S_WARNING
}
+ids {
+ code: PG_NO_LOCKING_SUPPORT
+ severity: S_WARNING
+} \ No newline at end of file
diff --git a/ydb/library/yql/sql/pg/pg_sql.cpp b/ydb/library/yql/sql/pg/pg_sql.cpp
index b3f71dc6c1..ea46e5435b 100644
--- a/ydb/library/yql/sql/pg/pg_sql.cpp
+++ b/ydb/library/yql/sql/pg/pg_sql.cpp
@@ -946,11 +946,10 @@ public:
AddError(TStringBuilder() << "LimitOption unsupported value: " << (int)x->limitOption);
return nullptr;
}
- }
- if (ListLength(x->lockingClause) > 0) {
- AddError("SelectStmt: not supported lockingClause");
- return nullptr;
+ if (ListLength(x->lockingClause) > 0) {
+ AddWarning(TIssuesIds::PG_NO_LOCKING_SUPPORT, "SelectStmt: lockingClause is ignored");
+ }
}
TVector<TAstNode*> res;
@@ -1054,8 +1053,7 @@ public:
}
if (ListLength(value->lockingClause) > 0) {
- AddError("SelectStmt: not supported lockingClause");
- return nullptr;
+ AddWarning(TIssuesIds::PG_NO_LOCKING_SUPPORT, "SelectStmt: lockingClause is ignored");
}
TAstNode* limit = nullptr;
diff --git a/ydb/library/yql/sql/pg/pg_sql_ut.cpp b/ydb/library/yql/sql/pg/pg_sql_ut.cpp
index fc80695c2f..864bddff97 100644
--- a/ydb/library/yql/sql/pg/pg_sql_ut.cpp
+++ b/ydb/library/yql/sql/pg/pg_sql_ut.cpp
@@ -5,10 +5,18 @@
using namespace NSQLTranslation;
Y_UNIT_TEST_SUITE(PgSqlParsingOnly) {
+ Y_UNIT_TEST(Locking) {
+ auto res = PgSqlToYql("SELECT 1 FROM plato.Input FOR UPDATE");
+ UNIT_ASSERT(res.Root);
+ UNIT_ASSERT_EQUAL(res.Issues.Size(), 1);
+
+ auto issue = *(res.Issues.begin());
+ UNIT_ASSERT(issue.GetMessage().find("locking") != TString::npos);
+ }
+
Y_UNIT_TEST(InsertStmt) {
auto res = PgSqlToYql("INSERT INTO plato.Input VALUES (1, 1)");
UNIT_ASSERT(res.Root);
- res.Root->PrintTo(Cerr);
}
Y_UNIT_TEST(InsertStmt_DefaultValues) {
@@ -397,7 +405,6 @@ SELECT COUNT(*) FROM public.t;");
Y_UNIT_TEST(UpdateStmt) {
auto res = PgSqlToYql("UPDATE plato.Input SET kind = 'test' where kind = 'testtest'");
- Cerr << res.Root->ToString();
TString updateStmtProg = R"(
(
(let world (Configure! world (DataSource 'config) 'OrderedColumns))