aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxenoxeno <xeno@ydb.tech>2023-06-06 07:41:00 +0300
committerxenoxeno <xeno@ydb.tech>2023-06-06 07:41:00 +0300
commitf1f928b18d8717cdaa18cb7fadf95685effb5842 (patch)
tree008ebb9bd345180860304e972f4f859ce9046bc5
parenta11456853376619a0b5e3b5186434afd579608a4 (diff)
downloadydb-f1f928b18d8717cdaa18cb7fadf95685effb5842.tar.gz
basic support for kqp transactions
-rw-r--r--ydb/core/local_pgwire/pgwire_kqp_proxy.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp b/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp
index c5d893f141..4533954dfb 100644
--- a/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp
+++ b/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp
@@ -175,9 +175,6 @@ public:
}
auto event = MakeHolder<NKqp::TEvKqp::TEvQueryRequest>();
NKikimrKqp::TQueryRequest& request = *event->Record.MutableRequest();
- request.SetQuery(ToPgSyntax(query, ConnectionParams_));
- request.SetAction(NKikimrKqp::QUERY_ACTION_EXECUTE);
- request.SetType(NKikimrKqp::QUERY_TYPE_SQL_GENERIC_QUERY);
request.MutableTxControl()->mutable_begin_tx()->mutable_serializable_read_write();
request.MutableTxControl()->set_commit_tx(true);
request.SetKeepSession(false);
@@ -188,12 +185,19 @@ public:
if (query.starts_with("BEGIN")) {
Tag = "BEGIN";
TransactionStatus = 'T';
+ request.SetAction(NKikimrKqp::QUERY_ACTION_BEGIN_TX);
} else if (query.starts_with("COMMIT")) {
Tag = "COMMIT";
TransactionStatus = 'I';
+ request.SetAction(NKikimrKqp::QUERY_ACTION_COMMIT_TX);
} else if (query.starts_with("ROLLBACK")) {
Tag = "ROLLBACK";
TransactionStatus = 'I';
+ request.SetAction(NKikimrKqp::QUERY_ACTION_ROLLBACK_TX);
+ } else {
+ request.SetAction(NKikimrKqp::QUERY_ACTION_EXECUTE);
+ request.SetType(NKikimrKqp::QUERY_TYPE_SQL_GENERIC_QUERY);
+ request.SetQuery(ToPgSyntax(query, ConnectionParams_));
}
ActorIdToProto(SelfId(), event->Record.MutableRequestActorId());