diff --git a/scripts-available/CDB_ColumnNames.sql b/scripts-available/CDB_ColumnNames.sql index 22842bd..c35ba99 100644 --- a/scripts-available/CDB_ColumnNames.sql +++ b/scripts-available/CDB_ColumnNames.sql @@ -5,9 +5,9 @@ AS $$ SELECT a.attname::information_schema.sql_identifier column_name FROM pg_class c - LEFT JOIN pg_catalog.pg_attribute a ON a.attrelid = c.oid + LEFT JOIN pg_attribute a ON a.attrelid = c.oid WHERE c.oid = $1::oid - AND a.attstattarget = -1 + AND a.attstattarget < 0 -- exclude system columns ORDER BY a.attnum; $$ LANGUAGE SQL; diff --git a/scripts-available/CDB_ColumnType.sql b/scripts-available/CDB_ColumnType.sql index eedc4a0..19b8934 100644 --- a/scripts-available/CDB_ColumnType.sql +++ b/scripts-available/CDB_ColumnType.sql @@ -3,12 +3,12 @@ CREATE OR REPLACE FUNCTION CDB_ColumnType(REGCLASS, TEXT) RETURNS information_schema.character_data AS $$ SELECT - pg_catalog.format_type(a.atttypid, NULL)::information_schema.character_data data_type + format_type(a.atttypid, NULL)::information_schema.character_data data_type FROM pg_class c - LEFT JOIN pg_catalog.pg_attribute a ON a.attrelid = c.oid + LEFT JOIN pg_attribute a ON a.attrelid = c.oid WHERE c.oid = $1::oid AND a.attname = $2 - AND a.attstattarget = -1; + AND a.attstattarget < 0; -- exclude system columns $$ LANGUAGE SQL; -- This is to migrate from pre-0.2.0 version diff --git a/scripts-available/CDB_Overviews.sql b/scripts-available/CDB_Overviews.sql index 04de527..0e692e7 100644 --- a/scripts-available/CDB_Overviews.sql +++ b/scripts-available/CDB_Overviews.sql @@ -522,12 +522,12 @@ AS $$ SELECT EXISTS ( SELECT a.attname FROM pg_class c - LEFT JOIN pg_catalog.pg_attribute a ON a.attrelid = c.oid - LEFT JOIN pg_catalog.pg_type t ON t.oid = a.atttypid + LEFT JOIN pg_attribute a ON a.attrelid = c.oid + LEFT JOIN pg_type t ON t.oid = a.atttypid WHERE c.oid = reloid AND a.attname = col_name - AND pg_catalog.format_type(a.atttypid, NULL) IN ('text', 'character varying', 'character') - AND pg_catalog.format_type(a.atttypid, NULL) = pg_catalog.format_type(a.atttypid, a.atttypmod) + AND format_type(a.atttypid, NULL) IN ('text', 'character varying', 'character') + AND format_type(a.atttypid, NULL) = format_type(a.atttypid, a.atttypmod) ); $$ LANGUAGE SQL STABLE;