Skip to content

Commit e811371

Browse files
committed
Bug fix for CREATE VIEW cases (which also load view metadata, but there is no PreparedQuery)
1 parent 02df54f commit e811371

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ydb/core/kqp/provider/yql_kikimr_datasource.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,11 @@ class TKiSourceLoadTableMetadataTransformer : public TGraphTransformerBase {
352352
return TStatus::Error;
353353
}
354354

355-
if (res.Metadata->Kind == EKikimrTableKind::View) {
355+
if (const auto& preparingQuery = SessionCtx->Query().PreparingQuery;
356+
preparingQuery
357+
&& res.Metadata->Kind == EKikimrTableKind::View
358+
) {
356359
const auto& viewMetadata = *res.Metadata;
357-
const auto& preparingQuery = SessionCtx->Query().PreparingQuery;
358-
YQL_ENSURE(preparingQuery);
359360
auto* viewInfo = preparingQuery->MutablePhysicalQuery()->MutableViewsInfo()->Add();
360361
auto* pathId = viewInfo->MutableTableId();
361362
pathId->SetOwnerId(viewMetadata.PathId.OwnerId());

0 commit comments

Comments
 (0)