ydb-platform / ydb

YDB is an open source Distributed SQL Database that combines high availability and scalability with strong consistency and ACID transactions
https://ydb.tech
Apache License 2.0
3.87k stars 533 forks source link

Empty table list over PG protocol in FineBI #6078

Closed SloNN closed 1 month ago

SloNN commented 3 months ago

FineBI makes several queries to find table List, but receives empty result. Please support for table listing in FineBI

...
"" Query: "SELECT nspname AS TABLE_SCHEM, NULL AS TABLE_CATALOG FROM pg_catalog.pg_namespace  WHERE nspname <> 'pg_toast' AND (nspname !~ '^pg_temp_'  OR nspname = (pg_catalog.current_schemas(true))[1]) AND (nspname !~ '^pg_toast_temp_'  OR nspname = replace((pg_catalog.current_schemas(true))[1], 'pg_temp_', 'pg_toast_temp_'))  ORDER BY TABLE_SCHEM"

Query: "WITH x AS (SELECT
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    current_database()::information_schema.sql_identifier AS table_catalog,
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    nsp.nspname AS table_schema,
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    tbl.relname AS table_name,
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    CASE
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    WHEN tbl.relkind='r'::"char" THEN 'TABLE' ::text
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    WHEN tbl.relkind='f'::"char" THEN 'FOREIGN TABLE' ::text
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    ELSE NULL::text
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    END::information_schema.character_data AS table_type,
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    tbl.oid AS oid
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    FROM pg_class tbl, pg_namespace nsp
Jun 28 15:30:07 ydb-pg-5 ydbd[910]:    WHERE tbl.relkind IN ('r','f') AND tbl.relnamespace=nsp.oid AND nsp.nspname !~ '^pg_' AND nsp.nspname <> 'information_schema')
Jun 28 15:30:07 ydb-pg-5 ydbd[910]: SELECT * FROM x WHERE has_schema_privilege(x.table_schema, 'USAGE') AND has_table_privilege(x.oid, 'SELECT')AND x.table_catalog = 'Root/database'AND x.table_schema = ''"

SELECT * FROM x WHERE has_schema_privilege(x.table_schema, 'USAGE') AND has_table_privilege(x.oid, 'SELECT')AND x.table_catalog = 'Root/database'AND x.table_schema = ''"