@@ -1402,26 +1402,28 @@ struct TCatalog {
1402
1402
" lo_unlink"
1403
1403
}),
1404
1404
StaticTables ({
1405
- {" pg_catalog" , " pg_type" },
1406
- {" pg_catalog" , " pg_database" },
1407
- {" pg_catalog" , " pg_tablespace" },
1408
- {" pg_catalog" , " pg_shdescription" },
1409
- {" pg_catalog" , " pg_trigger" },
1410
- {" pg_catalog" , " pg_locks" },
1411
- {" pg_catalog" , " pg_stat_gssapi" },
1412
- {" pg_catalog" , " pg_inherits" },
1413
- {" pg_catalog" , " pg_stat_activity" },
1414
- {" pg_catalog" , " pg_timezone_names" },
1415
- {" pg_catalog" , " pg_timezone_abbrevs" },
1416
- {" pg_catalog" , " pg_tables" },
1417
- {" pg_catalog" , " pg_description" },
1418
- {" pg_catalog" , " pg_am" },
1419
- {" pg_catalog" , " pg_namespace" },
1420
- {" pg_catalog" , " pg_auth_members" },
1421
- {" pg_catalog" , " pg_roles" },
1422
- {" information_schema" , " tables" },
1423
- {" information_schema" , " columns" },
1424
- {" information_schema" , " table_constraints" },
1405
+ {{" pg_catalog" , " pg_type" }, ERelKind::Relation, TypeRelationOid},
1406
+ {{" pg_catalog" , " pg_database" }, ERelKind::Relation, DatabaseRelationOid},
1407
+ {{" pg_catalog" , " pg_tablespace" }, ERelKind::Relation, TableSpaceRelationOid},
1408
+ {{" pg_catalog" , " pg_shdescription" }, ERelKind::Relation, SharedDescriptionRelationOid},
1409
+ {{" pg_catalog" , " pg_trigger" }, ERelKind::Relation, TriggerRelationOid},
1410
+ {{" pg_catalog" , " pg_locks" }, ERelKind::View, 10000 },
1411
+ {{" pg_catalog" , " pg_stat_gssapi" }, ERelKind::View, 10001 },
1412
+ {{" pg_catalog" , " pg_inherits" }, ERelKind::Relation, InheritsRelationOid},
1413
+ {{" pg_catalog" , " pg_stat_activity" }, ERelKind::View, 10002 },
1414
+ {{" pg_catalog" , " pg_timezone_names" }, ERelKind::View, 10003 },
1415
+ {{" pg_catalog" , " pg_timezone_abbrevs" }, ERelKind::View, 10004 },
1416
+ {{" pg_catalog" , " pg_tables" }, ERelKind::View, 10005 },
1417
+ {{" pg_catalog" , " pg_description" }, ERelKind::Relation, DescriptionRelationOid},
1418
+ {{" pg_catalog" , " pg_am" }, ERelKind::Relation, AccessMethodRelationOid},
1419
+ {{" pg_catalog" , " pg_namespace" }, ERelKind::Relation, NamespaceRelationOid},
1420
+ {{" pg_catalog" , " pg_auth_members" }, ERelKind::Relation, AuthMemRelationOid},
1421
+ {{" pg_catalog" , " pg_roles" }, ERelKind::View, 10006 },
1422
+ {{" pg_catalog" , " pg_stat_database" }, ERelKind::View, 10007 },
1423
+ {{" pg_catalog" , " pg_class" }, ERelKind::Relation, RelationRelationOid},
1424
+ {{" information_schema" , " tables" }, ERelKind::View, 10008 },
1425
+ {{" information_schema" , " columns" }, ERelKind::View, 10009 },
1426
+ {{" information_schema" , " table_constraints" }, ERelKind::View, 10010 },
1425
1427
}),
1426
1428
AllStaticColumns ({
1427
1429
{" pg_catalog" , " pg_type" , " oid" , " oid" },
@@ -1510,6 +1512,24 @@ struct TCatalog {
1510
1512
{" pg_catalog" , " pg_roles" , " rolsuper" , " bool" },
1511
1513
{" pg_catalog" , " pg_roles" , " rolvaliduntil" , " timestamptz" },
1512
1514
1515
+ {" pg_catalog" , " pg_stat_database" , " datid" , " oid" },
1516
+ {" pg_catalog" , " pg_stat_database" , " blks_hit" , " int8" },
1517
+ {" pg_catalog" , " pg_stat_database" , " blks_read" , " int8" },
1518
+ {" pg_catalog" , " pg_stat_database" , " tup_deleted" , " int8" },
1519
+ {" pg_catalog" , " pg_stat_database" , " tup_fetched" , " int8" },
1520
+ {" pg_catalog" , " pg_stat_database" , " tup_inserted" , " int8" },
1521
+ {" pg_catalog" , " pg_stat_database" , " tup_returned" , " int8" },
1522
+ {" pg_catalog" , " pg_stat_database" , " tup_updated" , " int8" },
1523
+ {" pg_catalog" , " pg_stat_database" , " xact_commit" , " int8" },
1524
+ {" pg_catalog" , " pg_stat_database" , " xact_rollback" , " int8" },
1525
+
1526
+ {" pg_catalog" , " pg_class" , " oid" , " oid" },
1527
+ {" pg_catalog" , " pg_class" , " relispartition" , " bool" },
1528
+ {" pg_catalog" , " pg_class" , " relkind" , " char" },
1529
+ {" pg_catalog" , " pg_class" , " relname" , " name" },
1530
+ {" pg_catalog" , " pg_class" , " relnamespace" , " oid" },
1531
+ {" pg_catalog" , " pg_class" , " relowner" , " oid" },
1532
+
1513
1533
{" information_schema" , " tables" , " table_schema" , " name" },
1514
1534
{" information_schema" , " tables" , " table_name" , " name" },
1515
1535
@@ -1523,12 +1543,14 @@ struct TCatalog {
1523
1543
{" information_schema" , " table_constraints" , " constraint_type" , " varchar" },
1524
1544
})
1525
1545
{
1546
+ THashSet<ui32> usedTableOids;
1526
1547
for (const auto & t : StaticTables) {
1527
1548
StaticColumns.insert (std::make_pair (t, TVector<TColumnInfo>()));
1549
+ Y_ENSURE (usedTableOids.insert (t.Oid ).first );
1528
1550
}
1529
1551
1530
1552
for (const auto & c: AllStaticColumns) {
1531
- auto tablePtr = StaticColumns.FindPtr (TTableInfo {c.Schema , c.TableName });
1553
+ auto tablePtr = StaticColumns.FindPtr (TTableInfoKey {c.Schema , c.TableName });
1532
1554
Y_ENSURE (tablePtr);
1533
1555
tablePtr->push_back (c);
1534
1556
}
@@ -1740,7 +1762,7 @@ struct TCatalog {
1740
1762
1741
1763
TVector<TTableInfo> StaticTables;
1742
1764
TVector<TColumnInfo> AllStaticColumns;
1743
- THashMap<TTableInfo , TVector<TColumnInfo>> StaticColumns;
1765
+ THashMap<TTableInfoKey , TVector<TColumnInfo>> StaticColumns;
1744
1766
};
1745
1767
1746
1768
bool ValidateArgs (const TVector<ui32>& descArgTypeIds, const TVector<ui32>& argTypeIds) {
@@ -2904,7 +2926,7 @@ const TVector<TTableInfo>& GetStaticTables() {
2904
2926
return catalog.StaticTables ;
2905
2927
}
2906
2928
2907
- const THashMap<TTableInfo , TVector<TColumnInfo>>& GetStaticColumns () {
2929
+ const THashMap<TTableInfoKey , TVector<TColumnInfo>>& GetStaticColumns () {
2908
2930
const auto & catalog = TCatalog::Instance ();
2909
2931
return catalog.StaticColumns ;
2910
2932
}
0 commit comments