Copy cartodb lib/sql scripts from CDB_CartodbfyTable branch

This commit is contained in:
Sandro Santilli
2014-05-05 17:13:06 +02:00
parent 7a5ce833a4
commit 2f1fdf5a15
43 changed files with 1569 additions and 4 deletions

View File

@@ -0,0 +1,16 @@
-- Function returning the column names of a table
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 || '';
$$ LANGUAGE SQL;
-- This is a private function, so only the db owner need privileges
REVOKE ALL ON FUNCTION CDB_ColumnNames(REGCLASS) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION CDB_ColumnNames(REGCLASS) TO ":DATABASE_USERNAME";