File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,8 @@ NSQLTranslation::TTranslationSettings GetTranslationSettings(NYql::EKikimrQueryT
95
95
settings.DefaultCluster = cluster;
96
96
settings.ClusterMapping = {
97
97
{cluster, TString (NYql::KikimrProviderName)},
98
- {" pg_catalog" , TString (NYql::PgProviderName)}
98
+ {" pg_catalog" , TString (NYql::PgProviderName)},
99
+ {" information_schema" , TString (NYql::PgProviderName)}
99
100
};
100
101
auto tablePathPrefix = kqpTablePathPrefix;
101
102
if (!tablePathPrefix.empty ()) {
Original file line number Diff line number Diff line change @@ -39,6 +39,24 @@ Y_UNIT_TEST_SUITE(PgCatalog) {
39
39
])" , FormatResultSetYson (result.GetResultSet (0 )));
40
40
}
41
41
}
42
+
43
+ Y_UNIT_TEST (InformationSchema) {
44
+ TKikimrRunner kikimr (NKqp::TKikimrSettings ().SetWithSampleTables (false ));
45
+ auto db = kikimr.GetQueryClient ();
46
+ auto settings = NYdb::NQuery::TExecuteQuerySettings ().Syntax (NYdb::NQuery::ESyntax::Pg);
47
+ {
48
+ auto result = db.ExecuteQuery (R"(
49
+ select column_name from information_schema.columns
50
+ order by table_schema, table_name, column_name limit 5
51
+ )" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx (), settings).ExtractValueSync ();
52
+ UNIT_ASSERT_C (result.IsSuccess (), result.GetIssues ().ToString ());
53
+ UNIT_ASSERT_C (!result.GetResultSets ().empty (), " no result sets" );
54
+ CompareYson (R"( [
55
+ ["authorization_identifier"];["fdwoptions"];["fdwowner"];["foreign_data_wrapper_catalog"];
56
+ ["foreign_data_wrapper_language"]
57
+ ])" , FormatResultSetYson (result.GetResultSet (0 )));
58
+ }
59
+ }
42
60
}
43
61
44
62
} // namespace NKqp
Original file line number Diff line number Diff line change @@ -2559,7 +2559,8 @@ class TConverter : public IPGParseEvents {
2559
2559
TAstNode* BuildTableKeyExpression (const TStringBuf relname,
2560
2560
const TStringBuf cluster, bool isScheme = false
2561
2561
) {
2562
- TString tableName = (cluster == " pg_catalog" ) ? TString (relname) : TablePathPrefix + relname;
2562
+ bool noPrefix = (cluster == " pg_catalog" || cluster == " information_schema" );
2563
+ TString tableName = noPrefix ? TString (relname) : TablePathPrefix + relname;
2563
2564
return L (A (" Key" ), QL (QA (isScheme ? " tablescheme" : " table" ),
2564
2565
L (A (" String" ), QAX (std::move (tableName)))));
2565
2566
}
You can’t perform that action at this time.
0 commit comments