@@ -844,7 +844,7 @@ TVector<TKiDataQueryBlock> MakeKiDataQueryBlocks(TExprBase node, const TKiExplor
844844
845845} // namespace
846846
847- TExprNode::TPtr KiBuildQuery (TExprBase node, TExprContext& ctx, TIntrusivePtr<TKikimrTablesData> tablesData,
847+ TExprNode::TPtr KiBuildQuery (TExprBase node, TExprContext& ctx, TStringBuf database, TIntrusivePtr<TKikimrTablesData> tablesData,
848848 TTypeAnnotationContext& types, bool concurrentResults) {
849849 if (!node.Maybe <TCoCommit>().DataSink ().Maybe <TKiDataSink>()) {
850850 return node.Ptr ();
@@ -858,14 +858,14 @@ TExprNode::TPtr KiBuildQuery(TExprBase node, TExprContext& ctx, TIntrusivePtr<TK
858858 VisitExpr (node.Ptr (), [&replaces](const TExprNode::TPtr& input) -> bool {
859859 if (input->IsCallable (" PgTableContent" )) {
860860 TPgTableContent content (input);
861- if (content.Table () == " pg_tables" ) {
861+ if (content.Table (). StringValue () == " pg_tables" ) {
862862 replaces[input.Get ()] = nullptr ;
863863 }
864864 }
865865 return true ;
866866 });
867867 if (!replaces.empty ()) {
868- TExprNode::TPtr path = ctx.NewCallable (node.Pos (), " String" , { ctx.NewAtom (node.Pos (), " /Root /.sys/pg_tables" ) });
868+ TExprNode::TPtr path = ctx.NewCallable (node.Pos (), " String" , { ctx.NewAtom (node.Pos (), TStringBuilder () << " / " << database << " /.sys/pg_tables" ) });
869869 auto table = ctx.NewList (node.Pos (), {ctx.NewAtom (node.Pos (), " table" ), path});
870870 auto newKey = ctx.NewCallable (node.Pos (), " Key" , {table});
871871
0 commit comments