summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/sql_query.cpp
diff options
context:
space:
mode:
authordeminds <[email protected]>2025-03-31 21:09:56 +0300
committerdeminds <[email protected]>2025-03-31 21:21:16 +0300
commit57acd8934a357817125b6a17e79fe89d035b1d24 (patch)
treec4dc08227b46d9d8e0826fc7b666d5aee53e5ff8 /yql/essentials/sql/v1/sql_query.cpp
parent0f618a68fd57833a29e1e41ef24e2eb012f344af (diff)
view: support show create in parser
commit_hash:1cf0e84327c47568687a689e091a6efbc8286bed
Diffstat (limited to 'yql/essentials/sql/v1/sql_query.cpp')
-rw-r--r--yql/essentials/sql/v1/sql_query.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/yql/essentials/sql/v1/sql_query.cpp b/yql/essentials/sql/v1/sql_query.cpp
index ec72610a244..627f1e0ae33 100644
--- a/yql/essentials/sql/v1/sql_query.cpp
+++ b/yql/essentials/sql/v1/sql_query.cpp
@@ -191,7 +191,7 @@ static bool TransferSettingsEntry(std::map<TString, TNodePtr>& out,
ctx.Context().Error() << key.Name << " is not supported in ALTER";
return false;
}
-
+
if (!out.emplace(keyName, value).second) {
ctx.Context().Error() << "Duplicate transfer setting: " << key.Name;
}
@@ -1961,7 +1961,7 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
break;
}
case TRule_sql_stmt_core::kAltSqlStmtCore62: {
- // show_create_table_stmt: SHOW CREATE TABLE table_ref
+ // show_create_table_stmt: SHOW CREATE (TABLE | VIEW) table_ref
Ctx.BodyPart();
const auto& rule = core.GetAlt_sql_stmt_core62().GetRule_show_create_table_stmt1();
@@ -1969,8 +1969,16 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (!SimpleTableRefImpl(rule.GetRule_simple_table_ref4(), tr)) {
return false;
}
+ TString type;
+ if (auto typeToken = to_lower(rule.GetToken3().GetValue()); typeToken == "table") {
+ type = "showCreateTable";
+ } else if (typeToken == "view") {
+ type = "showCreateView";
+ } else {
+ YQL_ENSURE(false, "Unsupported SHOW CREATE statement type: " << typeToken);
+ }
- AddStatementToBlocks(blocks, BuildShowCreate(Ctx.Pos(), tr, Ctx.Scoped));
+ AddStatementToBlocks(blocks, BuildShowCreate(Ctx.Pos(), tr, type, Ctx.Scoped));
break;
}
case TRule_sql_stmt_core::ALT_NOT_SET: