Adds test to check cartodbfy works with null cartodb_id

This commit is contained in:
Guido Fioravantti 2015-09-29 18:03:20 +02:00
parent bce61c1e43
commit 777e8c6e4c
2 changed files with 62 additions and 1 deletions

View File

@ -250,7 +250,7 @@ INSERT INTO existing_cartodb_id (cartodb_id, description) VALUES
(20, 'b'), (20, 'b'),
(30, 'c'); (30, 'c');
SELECT CDB_CartodbfyTableCheck('existing_cartodb_id', 'Existing cartodb_id values are respected #138'); 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; DROP TABLE existing_cartodb_id;
-- Table with both the_geom and wkb_geometry -- 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'); SELECT CDB_CartodbfyTableCheck('many_colliding_columns', 'Many colliding columns #141');
DROP TABLE many_colliding_columns; 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 -- TODO: table with existing custom-triggered the_geom

View File

@ -79,5 +79,28 @@ CREATE TABLE
INSERT 0 1 INSERT 0 1
Many colliding columns #141 cartodbfied fine Many colliding columns #141 cartodbfied fine
DROP TABLE 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
DROP FUNCTION DROP FUNCTION