diff options
author | Vitaly Stoyan <vitstn@gmail.com> | 2022-06-27 19:04:15 +0300 |
---|---|---|
committer | Vitaly Stoyan <vitstn@gmail.com> | 2022-06-27 19:04:15 +0300 |
commit | b1f45896cfd344d7e216f14a0ae66d385430c5b3 (patch) | |
tree | 2e81f5c6b97358e3ed5cd123047b7e67bf0874ff | |
parent | cdd411fc135d01beba3ea0cbdcc953463a9b554b (diff) | |
download | ydb-b1f45896cfd344d7e216f14a0ae66d385430c5b3.tar.gz |
YQL-14728 bare star should not include external columns
%%
select
(select * from (select 1) b)
from (values (1,2),(2,3),(3,4)) a(x,y)
%%
ref:ae937ae154cf3a1e27275133709a0dd4017ff7e0
-rw-r--r-- | ydb/library/yql/core/type_ann/type_ann_pg.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/ydb/library/yql/core/type_ann/type_ann_pg.cpp b/ydb/library/yql/core/type_ann/type_ann_pg.cpp index 1fa8f7400a..3aaf3e0bb2 100644 --- a/ydb/library/yql/core/type_ann/type_ann_pg.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_pg.cpp @@ -1412,18 +1412,7 @@ bool ScanColumns(TExprNode::TPtr root, TInputs& inputs, const THashSet<TString>& isError = true; return false; } - - for (auto& x : inputs) { - if (x.External) { - for (const auto& i : x.Type->GetItems()) { - if (!i->GetName().StartsWith("_yql_")) { - x.UsedExternalColumns.insert(TString(i->GetName())); - } - } - } - } - } - else if (node->IsCallable("PgQualifiedStar")) { + } else if (node->IsCallable("PgQualifiedStar")) { if (!hasStar || !qualifiedRefs) { ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(node->Pos()), "Star is not allowed here")); isError = true; @@ -1679,6 +1668,10 @@ void AddColumns(const TInputs& inputs, const bool* hasStar, const THashSet<TStri } if (hasStar && *hasStar) { + if (x.External) { + continue; + } + for (ui32 i = 0; i < x.Type->GetSize(); ++i) { auto item = x.Type->GetItems()[i]; if (!item->GetName().StartsWith("_yql_")) { @@ -1752,6 +1745,10 @@ IGraphTransformer::TStatus RebuildLambdaColumns(const TExprNode::TPtr& root, con continue; } + if (x.External) { + continue; + } + auto order = x.Order; for (const auto& item : x.Type->GetItems()) { if (!item->GetName().StartsWith("_yql_")) { |