cartodb-postgresql/test/CDB_QueryTablesTest.sql

42 lines
1.5 KiB
MySQL
Raw Normal View History

2017-04-10 19:50:37 +08:00
SET client_min_messages TO warning;
2017-04-10 21:58:49 +08:00
\set VERBOSITY terse
WITH inp AS ( select 'SELECT * FROM geometry_columns'::text as q )
SELECT q, CDB_QueryTables(q) from inp;
WITH inp AS ( select 'SELECT a.attname FROM pg_class c JOIN pg_attribute a on (a.attrelid = c.oid)'::text as q )
SELECT q, CDB_QueryTables(q) from inp;
WITH inp AS ( select $quote$CREATE table "my'tab;le" as select 1$quote$::text as q )
SELECT q, CDB_QueryTables(q) from inp;
WITH inp AS ( select 'SELECT a.oid, b.oid FROM pg_class a, pg_class b'::text as q )
SELECT q, CDB_QueryTables(q) from inp;
WITH inp AS ( select 'SELECT 1 as col1; select 2 as col2'::text as q )
SELECT q, CDB_QueryTables(q) from inp;
WITH inp AS ( select 'select 1 from nonexistant'::text as q )
SELECT q, CDB_QueryTables(q) from inp;
WITH inp AS ( select 'begin; select * from pg_class; commit;'::text as q )
SELECT q, CDB_QueryTables(q) from inp;
WITH inp AS ( select 'create table test (a int); insert into test values (1); select * from test;'::text as q )
SELECT q, CDB_QueryTables(q) from inp;
WITH inp AS ( select 'WITH a AS (select * from pg_class) select * from a'::text as q )
SELECT q, CDB_QueryTables(q) from inp;
CREATE SCHEMA sc;
create table sc.test (a int);
insert into sc.test values (1);
WITH inp AS ( select 'select * from sc.test'::text as q )
SELECT q, CDB_QueryTables(q) from inp;
2015-06-02 01:57:30 +08:00
DROP TABLE sc.test;
DROP SCHEMA sc;
2015-02-12 17:57:12 +08:00
WITH inp AS ( select 'SELECT
* FROM geometry_columns'::text as q )
SELECT q, CDB_QueryTables(q) from inp;