diff --git a/test/CDB_CartodbfyTableTest.sql b/test/CDB_CartodbfyTableTest.sql index 02c9039..3eef85d 100644 --- a/test/CDB_CartodbfyTableTest.sql +++ b/test/CDB_CartodbfyTableTest.sql @@ -372,6 +372,19 @@ SELECT column_name FROM information_schema.columns WHERE table_name = 'test' AND DROP TABLE test; SET client_min_messages TO error; +-- Unique identifier generation can break CDB_CartodbfyTable #305 +BEGIN; + DO $$ + BEGIN + FOR i IN 1..150 LOOP + EXECUTE 'CREATE TABLE untitled_table();'; + EXECUTE $query$SELECT CDB_CartodbfyTable('untitled_table');$query$; + EXECUTE 'ALTER TABLE untitled_table RENAME TO my_renamed_table_' || i; + END LOOP; + END; + $$; +ROLLBACK; + -- TODO: table with existing custom-triggered the_geom DROP FUNCTION CDB_CartodbfyTableCheck(regclass, text); diff --git a/test/CDB_CartodbfyTableTest_expect b/test/CDB_CartodbfyTableTest_expect index de2e9ae..5fca9ec 100644 --- a/test/CDB_CartodbfyTableTest_expect +++ b/test/CDB_CartodbfyTableTest_expect @@ -147,5 +147,8 @@ NOTICE: Trying to recover data from _cartodb_id0 column DROP TABLE SET +BEGIN +DO +ROLLBACK DROP FUNCTION DROP FUNCTION