diff --git a/test/CDB_CartodbfyTableTest.sql b/test/CDB_CartodbfyTableTest.sql index b35540b..42a23cf 100644 --- a/test/CDB_CartodbfyTableTest.sql +++ b/test/CDB_CartodbfyTableTest.sql @@ -250,7 +250,7 @@ INSERT INTO existing_cartodb_id (cartodb_id, description) VALUES (20, 'b'), (30, 'c'); SELECT CDB_CartodbfyTableCheck('existing_cartodb_id', 'Existing cartodb_id values are respected #138'); -SELECT * from existing_cartodb_id; +SELECT cartodb_id,the_geom,the_geom_webmercator,description,name from existing_cartodb_id; DROP TABLE existing_cartodb_id; -- Table with both the_geom and wkb_geometry @@ -281,6 +281,44 @@ INSERT INTO many_colliding_columns VALUES ( SELECT CDB_CartodbfyTableCheck('many_colliding_columns', 'Many colliding columns #141'); DROP TABLE many_colliding_columns; +-- table with null cartodb_id +CREATE TABLE test ( + cartodb_id integer +); +INSERT INTO test VALUES + (1), + (2), + (NULL), + (3); +SELECT CDB_CartodbfyTable('test'); +SELECT cartodb_id, cartodb_id_1 from test; +DROP TABLE test; + +-- table with non unique cartodb_id +CREATE TABLE test ( + cartodb_id integer +); +INSERT INTO test VALUES + (1), + (2), + (2); +SELECT CDB_CartodbfyTable('test'); +SELECT cartodb_id, cartodb_id_1 from test; +DROP TABLE test; + +-- table with non unique and null cartodb_id +CREATE TABLE test ( + cartodb_id integer +); +INSERT INTO test VALUES + (1), + (2), + (NULL), + (2); +SELECT CDB_CartodbfyTable('test'); +SELECT cartodb_id, cartodb_id_1 from test; +DROP TABLE test; + -- TODO: table with existing custom-triggered the_geom diff --git a/test/CDB_CartodbfyTableTest_expect b/test/CDB_CartodbfyTableTest_expect index 6287c3f..ab6c8e9 100644 --- a/test/CDB_CartodbfyTableTest_expect +++ b/test/CDB_CartodbfyTableTest_expect @@ -79,5 +79,28 @@ CREATE TABLE INSERT 0 1 Many colliding columns #141 cartodbfied fine DROP TABLE +CREATE TABLE +INSERT 0 4 +test +1|1 +2|2 +3| +4|3 +DROP TABLE +CREATE TABLE +INSERT 0 3 +test +1|1 +2|2 +3|2 +DROP TABLE +CREATE TABLE +INSERT 0 4 +test +1|1 +2|2 +3| +4|2 +DROP TABLE DROP FUNCTION DROP FUNCTION