aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Stoyan <vvvv@ydb.tech>2024-01-27 02:02:51 +0300
committerGitHub <noreply@github.com>2024-01-27 02:02:51 +0300
commita7dad28338e49d920879eb2b3e728ee6dd166b6e (patch)
tree2c1c13dfedfd92fa43cd9f68db1c5d1c8dcf603b
parenta27679995b1bc55627bc52942b6eb2af9f184fe8 (diff)
downloadydb-a7dad28338e49d920879eb2b3e728ee6dd166b6e.tar.gz
init (#1354)
-rw-r--r--ydb/library/yql/parser/pg_catalog/catalog.cpp120
-rw-r--r--ydb/library/yql/parser/pg_catalog/catalog.h30
-rw-r--r--ydb/library/yql/parser/pg_wrapper/comp_factory.cpp60
-rw-r--r--ydb/library/yql/providers/pg/provider/yql_pg_datasource_type_ann.cpp148
-rw-r--r--ydb/library/yql/tests/sql/dq_file/part16/canondata/result.json22
-rw-r--r--ydb/library/yql/tests/sql/sql2yql/canondata/result.json7
-rw-r--r--ydb/library/yql/tests/sql/suites/pg_catalog/columns.sql10
-rw-r--r--ydb/library/yql/tests/sql/yt_native_file/part14/canondata/result.json6
-rw-r--r--ydb/library/yql/tests/sql/yt_native_file/part16/canondata/result.json21
-rw-r--r--ydb/library/yql/tests/sql/yt_native_file/part3/canondata/result.json6
10 files changed, 253 insertions, 177 deletions
diff --git a/ydb/library/yql/parser/pg_catalog/catalog.cpp b/ydb/library/yql/parser/pg_catalog/catalog.cpp
index efb95f254d..5cd7c26fb4 100644
--- a/ydb/library/yql/parser/pg_catalog/catalog.cpp
+++ b/ydb/library/yql/parser/pg_catalog/catalog.cpp
@@ -1400,8 +1400,114 @@ struct TCatalog {
"lo_truncate64",
"lo_close",
"lo_unlink"
+ }),
+ StaticTables({
+ {"pg_catalog", "pg_type"},
+ {"pg_catalog", "pg_database"},
+ {"pg_catalog", "pg_tablespace"},
+ {"pg_catalog", "pg_shdescription"},
+ {"pg_catalog", "pg_trigger"},
+ {"pg_catalog", "pg_locks"},
+ {"pg_catalog", "pg_stat_gssapi"},
+ {"pg_catalog", "pg_inherits"},
+ {"pg_catalog", "pg_stat_activity"},
+ {"pg_catalog", "pg_timezone_names"},
+ {"pg_catalog", "pg_timezone_abbrevs"},
+ {"pg_catalog", "pg_tables"},
+ {"pg_catalog", "pg_description"},
+ {"pg_catalog", "pg_am"},
+ {"pg_catalog", "pg_namespace"},
+ {"information_schema", "tables"},
+ {"information_schema", "columns"},
+ }),
+ AllStaticColumns({
+ {"pg_catalog", "pg_type", "oid", "oid"},
+ {"pg_catalog", "pg_type", "typname", "name"},
+ {"pg_catalog", "pg_type", "typinput", "regproc"},
+ {"pg_catalog", "pg_type", "typnamespace", "oid"},
+ {"pg_catalog", "pg_type", "typtype", "char"},
+
+ {"pg_catalog", "pg_database", "oid", "oid"},
+ {"pg_catalog", "pg_database", "datname", "name"},
+ {"pg_catalog", "pg_database", "encoding", "int4"},
+ {"pg_catalog", "pg_database", "datallowconn", "bool"},
+ {"pg_catalog", "pg_database", "datistemplate", "bool"},
+ {"pg_catalog", "pg_database", "datdba", "oid"},
+
+ {"pg_catalog", "pg_tablespace", "oid", "oid"},
+ {"pg_catalog", "pg_tablespace", "spcname", "name"},
+
+ {"pg_catalog", "pg_shdescription", "objoid", "oid"},
+ {"pg_catalog", "pg_shdescription", "classoid", "oid"},
+ {"pg_catalog", "pg_shdescription", "description", "text"},
+
+ {"pg_catalog", "pg_trigger", "tgrelid", "oid"},
+ {"pg_catalog", "pg_trigger", "tgenabled", "char"},
+
+ {"pg_catalog", "pg_locks", "transactionid", "xid"},
+
+ {"pg_catalog", "pg_stat_gssapi", "encrypted", "bool"},
+ {"pg_catalog", "pg_stat_gssapi", "gss_authenticated", "bool"},
+ {"pg_catalog", "pg_stat_gssapi", "pid", "int4"},
+
+ {"pg_catalog", "pg_inherits", "inhrelid", "oid"},
+ {"pg_catalog", "pg_inherits", "inhparent", "oid"},
+
+ {"pg_catalog", "pg_stat_activity", "application_name", "text"},
+ {"pg_catalog", "pg_stat_activity", "backend_start", "timestamptz"},
+ {"pg_catalog", "pg_stat_activity", "backend_type", "text"},
+ {"pg_catalog", "pg_stat_activity", "client_addr", "inet"},
+ {"pg_catalog", "pg_stat_activity", "datname", "name"},
+ {"pg_catalog", "pg_stat_activity", "pid", "int4"},
+ {"pg_catalog", "pg_stat_activity", "query", "text"},
+ {"pg_catalog", "pg_stat_activity", "query_start", "timestamptz"},
+ {"pg_catalog", "pg_stat_activity", "state", "text"},
+ {"pg_catalog", "pg_stat_activity", "state_change", "timestamptz"},
+ {"pg_catalog", "pg_stat_activity", "usename", "name"},
+ {"pg_catalog", "pg_stat_activity", "wait_event", "text"},
+ {"pg_catalog", "pg_stat_activity", "wait_event_type", "text"},
+ {"pg_catalog", "pg_stat_activity", "xact_start", "timestamptz"},
+
+ {"pg_catalog", "pg_timezone_names", "name", "text"},
+ {"pg_catalog", "pg_timezone_names", "is_dst", "bool"},
+
+ {"pg_catalog", "pg_timezone_abbrevs", "abbrev", "text"},
+ {"pg_catalog", "pg_timezone_abbrevs", "is_dst", "bool"},
+
+ {"pg_catalog", "pg_tables", "schemaname", "name"},
+ {"pg_catalog", "pg_tables", "tablename", "name"},
+
+ {"pg_catalog", "pg_description", "objoid", "oid"},
+ {"pg_catalog", "pg_description", "classoid", "oid"},
+ {"pg_catalog", "pg_description", "objsubid", "int4"},
+ {"pg_catalog", "pg_description", "description", "text"},
+
+ {"pg_catalog", "pg_am", "oid", "oid"},
+ {"pg_catalog", "pg_am", "amname", "name"},
+ {"pg_catalog", "pg_am", "amtype", "char"},
+
+ {"pg_catalog", "pg_namespace", "nspname", "name"},
+ {"pg_catalog", "pg_namespace", "oid", "oid"},
+
+ {"information_schema", "tables", "table_schema", "name"},
+ {"information_schema", "tables", "table_name", "name"},
+
+ {"information_schema", "columns", "table_schema", "name"},
+ {"information_schema", "columns", "table_name", "name"},
+ {"information_schema", "columns", "column_name", "name"},
+ {"information_schema", "columns", "udt_name", "name"},
})
{
+ for (const auto& t : StaticTables) {
+ StaticColumns.insert(std::make_pair(t, TVector<TColumnInfo>()));
+ }
+
+ for (const auto& c: AllStaticColumns) {
+ auto tablePtr = StaticColumns.FindPtr(TTableInfo(c.Schema, c.TableName));
+ Y_ENSURE(tablePtr);
+ tablePtr->push_back(c);
+ }
+
TString typeData;
Y_ENSURE(NResource::FindExact("pg_type.dat", &typeData));
TString opData;
@@ -1602,6 +1708,10 @@ struct TCatalog {
THashMap<TString, TVector<ui32>> OperatorsByName;
THashMap<TString, TVector<ui32>> AggregationsByName;
THashSet<TString> ProhibitedProcs;
+
+ TVector<TTableInfo> StaticTables;
+ TVector<TColumnInfo> AllStaticColumns;
+ THashMap<TTableInfo, TVector<TColumnInfo>> StaticColumns;
};
bool ValidateArgs(const TVector<ui32>& descArgTypeIds, const TVector<ui32>& argTypeIds) {
@@ -2760,4 +2870,14 @@ bool IsCompatibleTo(ui32 actualType, ui32 expectedType) {
return IsCompatibleTo(actualType, expectedType, catalog.Types);
}
+const TVector<TTableInfo>& GetStaticTables() {
+ const auto& catalog = TCatalog::Instance();
+ return catalog.StaticTables;
+}
+
+const THashMap<TTableInfo, TVector<TColumnInfo>>& GetStaticColumns() {
+ const auto& catalog = TCatalog::Instance();
+ return catalog.StaticColumns;
+}
+
}
diff --git a/ydb/library/yql/parser/pg_catalog/catalog.h b/ydb/library/yql/parser/pg_catalog/catalog.h
index c3eb952e1a..357a44eee9 100644
--- a/ydb/library/yql/parser/pg_catalog/catalog.h
+++ b/ydb/library/yql/parser/pg_catalog/catalog.h
@@ -285,6 +285,29 @@ bool IsCoercible(ui32 fromTypeId, ui32 toTypeId, ECoercionCode coercionType);
inline bool IsArrayType(const TTypeDesc& typeDesc) noexcept {
return typeDesc.ArrayTypeId == typeDesc.TypeId;
}
+struct TTableInfo {
+ TString Schema;
+ TString Name;
+
+ bool operator==(const TTableInfo& other) const {
+ return Schema == other.Schema && Name == other.Name;
+ }
+
+ size_t Hash() const {
+ auto stringHasher = THash<TString>();
+ return CombineHashes(stringHasher(Schema), stringHasher(Name));
+ }
+};
+
+struct TColumnInfo {
+ TString Schema;
+ TString TableName;
+ TString Name;
+ TString UdtType;
+};
+
+const TVector<TTableInfo>& GetStaticTables();
+const THashMap<TTableInfo, TVector<TColumnInfo>>& GetStaticColumns();
}
@@ -297,3 +320,10 @@ template <>
inline void Out<NYql::NPg::ECoercionCode>(IOutputStream& o, NYql::NPg::ECoercionCode coercionCode) {
o.Write(static_cast<std::underlying_type<NYql::NPg::ECoercionCode>::type>(coercionCode));
}
+
+template <>
+struct THash<NYql::NPg::TTableInfo> {
+ size_t operator ()(const NYql::NPg::TTableInfo& val) const {
+ return val.Hash();
+ }
+};
diff --git a/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp b/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
index de32cd57fc..e9c2cf1872 100644
--- a/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
+++ b/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
@@ -352,8 +352,8 @@ public:
ApplyFillers(AllPgDescriptionFillers, Y_ARRAY_SIZE(AllPgDescriptionFillers), PgDescriptionFillers_);
} else if (Table_ == "pg_tables") {
static const std::pair<const char*, TTablesFiller> AllPgTablesFillers[] = {
- {"schemaname", [](const TTableInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Schema, NAMEDATALEN)); }},
- {"tablename", [](const TTableInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Name, NAMEDATALEN)); }},
+ {"schemaname", [](const NPg::TTableInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Schema, NAMEDATALEN)); }},
+ {"tablename", [](const NPg::TTableInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Name, NAMEDATALEN)); }},
};
ApplyFillers(AllPgTablesFillers, Y_ARRAY_SIZE(AllPgTablesFillers), PgTablesFillers_);
@@ -361,11 +361,20 @@ public:
} else {
if (Table_ == "tables") {
static const std::pair<const char*, TTablesFiller> AllTablesFillers[] = {
- {"table_schema", [](const TTableInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Schema, NAMEDATALEN)); }},
- {"table_name", [](const TTableInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Name, NAMEDATALEN)); }},
+ {"table_schema", [](const NPg::TTableInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Schema, NAMEDATALEN)); }},
+ {"table_name", [](const NPg::TTableInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Name, NAMEDATALEN)); }},
};
ApplyFillers(AllTablesFillers, Y_ARRAY_SIZE(AllTablesFillers), TablesFillers_);
+ } else if (Table_ == "columns") {
+ static const std::pair<const char*, TColumnsFiller> AllColumnsFillers[] = {
+ {"table_schema", [](const NPg::TColumnInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Schema, NAMEDATALEN)); }},
+ {"table_name", [](const NPg::TColumnInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.TableName, NAMEDATALEN)); }},
+ {"column_name", [](const NPg::TColumnInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.Name, NAMEDATALEN)); }},
+ {"udt_name", [](const NPg::TColumnInfo& desc) { return PointerDatumToPod((Datum)MakeFixedString(desc.UdtType, NAMEDATALEN)); }},
+ };
+
+ ApplyFillers(AllColumnsFillers, Y_ARRAY_SIZE(AllColumnsFillers), ColumnsFillers_);
}
}
}
@@ -539,7 +548,7 @@ public:
rows.emplace_back(row);
});
} else if (Table_ == "pg_tables") {
- auto tables = GetStaticTables();
+ const auto& tables = NPg::GetStaticTables();
for (const auto& t : tables) {
NUdf::TUnboxedValue* items;
auto row = compCtx.HolderFactory.CreateDirectArrayHolder(PgTablesFillers_.size(), items);
@@ -552,7 +561,7 @@ public:
}
} else {
if (Table_ == "tables") {
- auto tables = GetStaticTables();
+ const auto& tables = NPg::GetStaticTables();
for (const auto& t : tables) {
NUdf::TUnboxedValue* items;
auto row = compCtx.HolderFactory.CreateDirectArrayHolder(TablesFillers_.size(), items);
@@ -562,6 +571,19 @@ public:
rows.emplace_back(row);
}
+ } else if (Table_ == "columns") {
+ const auto& columns = NPg::GetStaticColumns();
+ for (const auto& t : columns) {
+ for (const auto& c : t.second) {
+ NUdf::TUnboxedValue* items;
+ auto row = compCtx.HolderFactory.CreateDirectArrayHolder(ColumnsFillers_.size(), items);
+ for (ui32 i = 0; i < ColumnsFillers_.size(); ++i) {
+ items[i] = ColumnsFillers_[i](c);
+ }
+
+ rows.emplace_back(row);
+ }
+ }
}
}
@@ -601,32 +623,12 @@ private:
using TPgDescriptionFiller = NUdf::TUnboxedValuePod(*)(const TDescriptionDesc&);
TVector<TPgDescriptionFiller> PgDescriptionFillers_;
- struct TTableInfo {
- TString Schema;
- TString Name;
- };
-
- using TTablesFiller = NUdf::TUnboxedValuePod(*)(const TTableInfo&);
+ using TTablesFiller = NUdf::TUnboxedValuePod(*)(const NPg::TTableInfo&);
TVector<TTablesFiller> PgTablesFillers_;
TVector<TTablesFiller> TablesFillers_;
- static TVector<TTableInfo> GetStaticTables() {
- return {
- {"pg_catalog", "pg_type"},
- {"pg_catalog", "pg_database"},
- {"pg_catalog", "pg_tablespace"},
- {"pg_catalog", "pg_shdescription"},
- {"pg_catalog", "pg_trigger"},
- {"pg_catalog", "pg_locks"},
- {"pg_catalog", "pg_stat_gssapi"},
- {"pg_catalog", "pg_inherits"},
- {"pg_catalog", "pg_stat_activity"},
- {"pg_catalog", "pg_timezone_names"},
- {"pg_catalog", "pg_timezone_abbrevs"},
- {"pg_catalog", "pg_tables"},
- {"information_schema", "tables"},
- };
- }
+ using TColumnsFiller = NUdf::TUnboxedValuePod(*)(const NPg::TColumnInfo&);
+ TVector<TColumnsFiller> ColumnsFillers_;
};
class TFunctionCallInfo {
diff --git a/ydb/library/yql/providers/pg/provider/yql_pg_datasource_type_ann.cpp b/ydb/library/yql/providers/pg/provider/yql_pg_datasource_type_ann.cpp
index df6c000ac1..b3ea99ecb3 100644
--- a/ydb/library/yql/providers/pg/provider/yql_pg_datasource_type_ann.cpp
+++ b/ydb/library/yql/providers/pg/provider/yql_pg_datasource_type_ann.cpp
@@ -107,49 +107,16 @@ public:
auto tableName = input->Child(TNode::idx_Table)->Content();
TVector<const TItemExprType*> items;
- if (cluster == "pg_catalog") {
- if (tableName == "pg_type") {
- FillPgTypeSchema(items, ctx);
- } else if (tableName == "pg_database") {
- FillPgDatabaseSchema(items, ctx);
- } else if (tableName == "pg_tablespace") {
- FillPgTablespaceSchema(items, ctx);
- } else if (tableName == "pg_shdescription") {
- FillPgShDescriptionSchema(items, ctx);
- } else if (tableName == "pg_trigger") {
- FillPgTriggerSchema(items, ctx);
- } else if (tableName == "pg_locks") {
- FillPgLocksSchema(items, ctx);
- } else if (tableName == "pg_stat_gssapi") {
- FillPgStatGssapiSchema(items, ctx);
- } else if (tableName == "pg_inherits") {
- FillPgInheritsSchema(items, ctx);
- } else if (tableName == "pg_stat_activity") {
- FillPgStatActivitySchema(items, ctx);
- } else if (tableName == "pg_timezone_names") {
- FillPgTimezoneNamesSchema(items, ctx);
- } else if (tableName == "pg_timezone_abbrevs") {
- FillPgTimezoneAbbrevsSchema(items, ctx);
- } else if (tableName == "pg_namespace") {
- FillPgNamespaceSchema(items, ctx);
- } else if (tableName == "pg_description") {
- FillPgDescriptionSchema(items, ctx);
- } else if (tableName == "pg_am") {
- FillPgAmSchema(items, ctx);
- } else if (tableName == "pg_tables") {
- FillPgTablesSchema(items, ctx);
- }
- } else {
- if (tableName == "tables") {
- FillTablesSchema(items, ctx);
- }
- }
-
- if (items.empty()) {
+ auto columnsPtr = NPg::GetStaticColumns().FindPtr(NPg::TTableInfo{ cluster, TString(tableName) });
+ if (!columnsPtr) {
ctx.AddError(TIssue(ctx.GetPosition(input->Child(TPgReadTable::idx_Table)->Pos()), TStringBuilder() << "Unsupported table: " << tableName));
return TStatus::Error;
}
+ for (const auto& c: *columnsPtr) {
+ AddColumn(items, ctx, c.Name, c.UdtType);
+ }
+
TVector<TString> columnOrder;
for (const auto& item : items) {
columnOrder.emplace_back(TString(item->GetName()));
@@ -176,109 +143,6 @@ public:
}
private:
- void FillPgTypeSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "oid", "oid");
- AddColumn(items, ctx, "typname", "name");
- AddColumn(items, ctx, "typinput", "regproc");
- AddColumn(items, ctx, "typnamespace", "oid");
- AddColumn(items, ctx, "typtype", "char");
- }
-
- void FillPgDatabaseSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "oid", "oid");
- AddColumn(items, ctx, "datname", "name");
- AddColumn(items, ctx, "encoding", "int4");
- AddColumn(items, ctx, "datallowconn", "bool");
- AddColumn(items, ctx, "datistemplate", "bool");
- AddColumn(items, ctx, "datdba", "oid");
- }
-
- void FillPgTablespaceSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "oid", "oid");
- AddColumn(items, ctx, "spcname", "name");
- }
-
- void FillPgShDescriptionSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "objoid", "oid");
- AddColumn(items, ctx, "classoid", "oid");
- AddColumn(items, ctx, "description", "text");
- }
-
- void FillPgTriggerSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "tgrelid", "oid");
- AddColumn(items, ctx, "tgenabled", "char");
- }
-
- void FillPgLocksSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "transactionid", "xid");
- }
-
- void FillPgStatGssapiSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "encrypted", "bool");
- AddColumn(items, ctx, "gss_authenticated", "bool");
- AddColumn(items, ctx, "pid", "int4");
- }
-
- void FillPgInheritsSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "inhrelid", "oid");
- AddColumn(items, ctx, "inhparent", "oid");
- }
-
- void FillPgStatActivitySchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "application_name", "text");
- AddColumn(items, ctx, "backend_start", "timestamptz");
- AddColumn(items, ctx, "backend_type", "text");
- AddColumn(items, ctx, "client_addr", "inet");
- AddColumn(items, ctx, "datname", "name");
- AddColumn(items, ctx, "pid", "int4");
- AddColumn(items, ctx, "query", "text");
- AddColumn(items, ctx, "query_start", "timestamptz");
- AddColumn(items, ctx, "state", "text");
- AddColumn(items, ctx, "state_change", "timestamptz");
- AddColumn(items, ctx, "usename", "name");
- AddColumn(items, ctx, "wait_event", "text");
- AddColumn(items, ctx, "wait_event_type", "text");
- AddColumn(items, ctx, "xact_start", "timestamptz");
- }
-
- void FillPgTimezoneNamesSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "name", "text");
- AddColumn(items, ctx, "is_dst", "bool");
- }
-
- void FillPgTimezoneAbbrevsSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "abbrev", "text");
- AddColumn(items, ctx, "is_dst", "bool");
- }
-
- void FillPgNamespaceSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "nspname", "name");
- AddColumn(items, ctx, "oid", "oid");
- }
-
- void FillPgDescriptionSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "objoid", "oid");
- AddColumn(items, ctx, "classoid", "oid");
- AddColumn(items, ctx, "objsubid", "int4");
- AddColumn(items, ctx, "description", "text");
- }
-
- void FillPgAmSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "oid", "oid");
- AddColumn(items, ctx, "amname", "name");
- AddColumn(items, ctx, "amtype", "char");
- }
-
- void FillPgTablesSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "schemaname", "name");
- AddColumn(items, ctx, "tablename", "name");
- }
-
- void FillTablesSchema(TVector<const TItemExprType*>& items, TExprContext& ctx) {
- AddColumn(items, ctx, "table_schema", "name");
- AddColumn(items, ctx, "table_name", "name");
- }
-
void AddColumn(TVector<const TItemExprType*>& items, TExprContext& ctx, const TString& name, const TString& type) {
items.push_back(ctx.MakeType<TItemExprType>(name, ctx.MakeType<TPgExprType>(NPg::LookupType(type).TypeId)));
}
diff --git a/ydb/library/yql/tests/sql/dq_file/part16/canondata/result.json b/ydb/library/yql/tests/sql/dq_file/part16/canondata/result.json
index 37a947d976..320fd2a7a7 100644
--- a/ydb/library/yql/tests/sql/dq_file/part16/canondata/result.json
+++ b/ydb/library/yql/tests/sql/dq_file/part16/canondata/result.json
@@ -2242,6 +2242,28 @@
}
],
"test.test[pg-tpcds-q83-default.txt-Results]": [],
+ "test.test[pg_catalog-columns-default.txt-Analyze]": [
+ {
+ "checksum": "c1f2d837c3623c81dd596a9877913fb8",
+ "size": 948,
+ "uri": "https://{canondata_backend}/1936947/709cd8d6c15b98e118e6f2bf0b58e3a7a05592dc/resource.tar.gz#test.test_pg_catalog-columns-default.txt-Analyze_/plan.txt"
+ }
+ ],
+ "test.test[pg_catalog-columns-default.txt-Debug]": [
+ {
+ "checksum": "e901bc8975a9c8098d76cd4fc646be11",
+ "size": 649,
+ "uri": "https://{canondata_backend}/1936947/709cd8d6c15b98e118e6f2bf0b58e3a7a05592dc/resource.tar.gz#test.test_pg_catalog-columns-default.txt-Debug_/opt.yql_patched"
+ }
+ ],
+ "test.test[pg_catalog-columns-default.txt-Plan]": [
+ {
+ "checksum": "c1f2d837c3623c81dd596a9877913fb8",
+ "size": 948,
+ "uri": "https://{canondata_backend}/1936947/709cd8d6c15b98e118e6f2bf0b58e3a7a05592dc/resource.tar.gz#test.test_pg_catalog-columns-default.txt-Plan_/plan.txt"
+ }
+ ],
+ "test.test[pg_catalog-columns-default.txt-Results]": [],
"test.test[pragma-config_exec--Analyze]": [
{
"checksum": "49226c5ed1226aacf447e83f0de3f342",
diff --git a/ydb/library/yql/tests/sql/sql2yql/canondata/result.json b/ydb/library/yql/tests/sql/sql2yql/canondata/result.json
index 57a191bac4..0e74ffabe1 100644
--- a/ydb/library/yql/tests/sql/sql2yql/canondata/result.json
+++ b/ydb/library/yql/tests/sql/sql2yql/canondata/result.json
@@ -13236,6 +13236,13 @@
"uri": "https://{canondata_backend}/1599023/af9c2f81df0601cf266a0926b5ce73b6101b9115/resource.tar.gz#test_sql2yql.test_pg-with_/sql.yql"
}
],
+ "test_sql2yql.test[pg_catalog-columns]": [
+ {
+ "checksum": "ad01ee87fdfba607d29bb90e48c4da83",
+ "size": 1081,
+ "uri": "https://{canondata_backend}/1871002/60f4e16a69c53e14b9754070f9b21a4dd421c869/resource.tar.gz#test_sql2yql.test_pg_catalog-columns_/sql.yql"
+ }
+ ],
"test_sql2yql.test[pg_catalog-lambda]": [
{
"checksum": "3a762deb072c530794191fdc864e9ce8",
diff --git a/ydb/library/yql/tests/sql/suites/pg_catalog/columns.sql b/ydb/library/yql/tests/sql/suites/pg_catalog/columns.sql
new file mode 100644
index 0000000000..e84f95ba0f
--- /dev/null
+++ b/ydb/library/yql/tests/sql/suites/pg_catalog/columns.sql
@@ -0,0 +1,10 @@
+--!syntax_pg
+select
+table_schema,
+table_name,
+column_name,
+udt_name
+from
+information_schema.columns
+order by table_schema, table_name, column_name
+
diff --git a/ydb/library/yql/tests/sql/yt_native_file/part14/canondata/result.json b/ydb/library/yql/tests/sql/yt_native_file/part14/canondata/result.json
index 28a839482e..f055f00367 100644
--- a/ydb/library/yql/tests/sql/yt_native_file/part14/canondata/result.json
+++ b/ydb/library/yql/tests/sql/yt_native_file/part14/canondata/result.json
@@ -2386,9 +2386,9 @@
],
"test.test[pg_catalog-pg_tables-default.txt-Results]": [
{
- "checksum": "40a0cc11ca3cade6503a95d7d62e609c",
- "size": 2450,
- "uri": "https://{canondata_backend}/1600758/bdc527da4970a74ab81bbc76ba66f5dbb6340187/resource.tar.gz#test.test_pg_catalog-pg_tables-default.txt-Results_/results.txt"
+ "checksum": "4b6af13d1956b092a48e70a81ba64926",
+ "size": 2936,
+ "uri": "https://{canondata_backend}/1936842/b1edddeb08d352926e347a4f529899d4533cd382/resource.tar.gz#test.test_pg_catalog-pg_tables-default.txt-Results_/results.txt"
}
],
"test.test[produce-process_rows_sorted_desc_multi_out--Debug]": [
diff --git a/ydb/library/yql/tests/sql/yt_native_file/part16/canondata/result.json b/ydb/library/yql/tests/sql/yt_native_file/part16/canondata/result.json
index c9e696b6c5..db9a2da2b5 100644
--- a/ydb/library/yql/tests/sql/yt_native_file/part16/canondata/result.json
+++ b/ydb/library/yql/tests/sql/yt_native_file/part16/canondata/result.json
@@ -1872,6 +1872,27 @@
"uri": "https://{canondata_backend}/1924537/d66bfe69aa802f6a81aadbac897621b721f31b4b/resource.tar.gz#test.test_pg-tpcds-q83-default.txt-Results_/results.txt"
}
],
+ "test.test[pg_catalog-columns-default.txt-Debug]": [
+ {
+ "checksum": "1b12a7681d7ccc79d7b113d5ac6fd561",
+ "size": 589,
+ "uri": "https://{canondata_backend}/1889210/850cc148b59fcf8cae8e282099dbcf559be79b4b/resource.tar.gz#test.test_pg_catalog-columns-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[pg_catalog-columns-default.txt-Plan]": [
+ {
+ "checksum": "c1f2d837c3623c81dd596a9877913fb8",
+ "size": 948,
+ "uri": "https://{canondata_backend}/1889210/850cc148b59fcf8cae8e282099dbcf559be79b4b/resource.tar.gz#test.test_pg_catalog-columns-default.txt-Plan_/plan.txt"
+ }
+ ],
+ "test.test[pg_catalog-columns-default.txt-Results]": [
+ {
+ "checksum": "430086549283aa70d6c84267af2663d6",
+ "size": 12690,
+ "uri": "https://{canondata_backend}/1889210/850cc148b59fcf8cae8e282099dbcf559be79b4b/resource.tar.gz#test.test_pg_catalog-columns-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[pragma-config_exec--Debug]": [
{
"checksum": "a596f026dd3d8d1d70d31d0c957b8f09",
diff --git a/ydb/library/yql/tests/sql/yt_native_file/part3/canondata/result.json b/ydb/library/yql/tests/sql/yt_native_file/part3/canondata/result.json
index d8a14f5252..ab083f6cba 100644
--- a/ydb/library/yql/tests/sql/yt_native_file/part3/canondata/result.json
+++ b/ydb/library/yql/tests/sql/yt_native_file/part3/canondata/result.json
@@ -1671,9 +1671,9 @@
],
"test.test[pg_catalog-tables-default.txt-Results]": [
{
- "checksum": "aec1d30f05185d9a4d18baa033e21b73",
- "size": 2453,
- "uri": "https://{canondata_backend}/1942100/3f6203e58cb404b40c036990713353e16c2dde44/resource.tar.gz#test.test_pg_catalog-tables-default.txt-Results_/results.txt"
+ "checksum": "6a8eecc07133c7ff93e0f4b10a932380",
+ "size": 2939,
+ "uri": "https://{canondata_backend}/1936842/870692fb961448eb455c0be956f87156694c42be/resource.tar.gz#test.test_pg_catalog-tables-default.txt-Results_/results.txt"
}
],
"test.test[produce-process_row_and_columns-default.txt-Debug]": [