CDB_ColumnNames uses schema and table name from regclass

Fixes #122
This commit is contained in:
Raul Ochoa
2015-09-02 12:04:52 +02:00
parent eb6fc4fefb
commit 4b5c5dd275
2 changed files with 20 additions and 5 deletions

View File

@@ -3,11 +3,12 @@ CREATE OR REPLACE FUNCTION CDB_ColumnNames(REGCLASS)
RETURNS SETOF information_schema.sql_identifier
AS $$
SELECT column_name
FROM information_schema.columns
WHERE
table_name IN (SELECT CDB_UserTables())
AND table_name = '' || $1 || '';
SELECT c.column_name
FROM information_schema.columns c, pg_class _tn, pg_namespace _sn
WHERE table_name = _tn.relname
AND table_schema = _sn.nspname
AND _tn.oid = $1::regclass::oid
AND _sn.oid = _tn.relnamespace;
$$ LANGUAGE SQL;