Fix CDB_Overviews for the case that the table name requires quoting
This commit is contained in:
@@ -26,11 +26,15 @@ $$ LANGUAGE PLPGSQL VOLATILE;
|
|||||||
CREATE OR REPLACE FUNCTION CDB_Overviews(reloid REGCLASS)
|
CREATE OR REPLACE FUNCTION CDB_Overviews(reloid REGCLASS)
|
||||||
RETURNS TABLE(z integer, overview_table REGCLASS)
|
RETURNS TABLE(z integer, overview_table REGCLASS)
|
||||||
AS $$
|
AS $$
|
||||||
|
-- FIXME: this will fail if the overview tables
|
||||||
|
-- require a explicit schema name
|
||||||
|
-- possible solutions: return table names as text instead of regclass
|
||||||
|
-- or add schema of reloid before casting to regclass
|
||||||
SELECT
|
SELECT
|
||||||
substring(cdb_usertables from '\d+$')::integer as z,
|
substring(cdb_usertables from '\d+$')::integer as z,
|
||||||
cdb_usertables::regclass as overview_table
|
cdb_usertables::regclass as overview_table
|
||||||
FROM CDB_UserTables()
|
FROM CDB_UserTables()
|
||||||
WHERE cdb_usertables SIMILAR TO reloid::text || '_ov[\d]+'
|
WHERE cdb_usertables SIMILAR TO (SELECT relname FROM pg_class WHERE oid=reloid) || '_ov[\d]+'
|
||||||
ORDER BY z;
|
ORDER BY z;
|
||||||
$$ LANGUAGE SQL;
|
$$ LANGUAGE SQL;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user