diff options
author | xenoxeno <xeno@ydb.tech> | 2023-08-01 12:03:55 +0300 |
---|---|---|
committer | xenoxeno <xeno@ydb.tech> | 2023-08-01 12:03:55 +0300 |
commit | f7019bf34ad6f821cd40ac2f12c59b315b6b0b1d (patch) | |
tree | 69a88672d7851ddae9732120ae4ec404cf4db808 | |
parent | 5daa7d57b63bd285c11fbb160b4f9b3c8b3e14e3 (diff) | |
download | ydb-f7019bf34ad6f821cd40ac2f12c59b315b6b0b1d.tar.gz |
🩼 workaround for scheme error test KIKIMR-18050
-rw-r--r-- | ydb/core/local_pgwire/pgwire_kqp_proxy.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp b/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp index 5c725080539..6c9898c5479 100644 --- a/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp +++ b/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp @@ -138,6 +138,18 @@ protected: TBase::Send(Owner_, new TEvEvents::TEvProxyCompleted(Connection_)); } + + void FillError(const NKikimrKqp::TEvQueryResponse& record, std::vector<std::pair<char, TString>>& errorFields) { + NYql::TIssues issues; + NYql::IssuesFromMessage(record.GetResponse().GetQueryIssues(), issues); + NYdb::TStatus status(NYdb::EStatus(record.GetYdbStatus()), std::move(issues)); + TString message(TStringBuilder() << status); + errorFields.push_back({'E', "ERROR"}); + errorFields.push_back({'M', message}); + if (message.find("Error: Cannot find table") != TString::npos) { + errorFields.push_back({'C', "42P01"}); + } + } }; class TPgwireKqpProxyQuery : public TPgwireKqpProxy<TPgwireKqpProxyQuery> { @@ -238,11 +250,7 @@ public: response->Tag = TStringBuilder() << response->Tag << " " << RowsSelected_; } } else { - NYql::TIssues issues; - NYql::IssuesFromMessage(record.GetResponse().GetQueryIssues(), issues); - NYdb::TStatus status(NYdb::EStatus(record.GetYdbStatus()), std::move(issues)); - response->ErrorFields.push_back({'E', "ERROR"}); - response->ErrorFields.push_back({'M', TStringBuilder() << status}); + FillError(record, response->ErrorFields); } } else { response->ErrorFields.push_back({'E', "ERROR"}); @@ -333,11 +341,7 @@ public: } Send(Owner_, new TEvEvents::TEvProxyCompleted(statement)); } else { - NYql::TIssues issues; - NYql::IssuesFromMessage(record.GetResponse().GetQueryIssues(), issues); - NYdb::TStatus status(NYdb::EStatus(record.GetYdbStatus()), std::move(issues)); - response->ErrorFields.push_back({'E', "ERROR"}); - response->ErrorFields.push_back({'M', TStringBuilder() << status}); + FillError(record, response->ErrorFields); } } else { response->ErrorFields.push_back({'E', "ERROR"}); @@ -448,11 +452,7 @@ public: response->Tag = TStringBuilder() << response->Tag << " " << RowsSelected_; } } else { - NYql::TIssues issues; - NYql::IssuesFromMessage(record.GetResponse().GetQueryIssues(), issues); - NYdb::TStatus status(NYdb::EStatus(record.GetYdbStatus()), std::move(issues)); - response->ErrorFields.push_back({'E', "ERROR"}); - response->ErrorFields.push_back({'M', TStringBuilder() << status}); + FillError(record, response->ErrorFields); } } else { response->ErrorFields.push_back({'E', "ERROR"}); |