Add idempotence test

This commit is contained in:
Carla Iriberri 2016-03-08 12:10:46 +01:00
parent d495bd45ba
commit 3d0f580fc2
2 changed files with 15 additions and 1 deletions

View File

@ -124,13 +124,21 @@ END;
$$ $$
LANGUAGE 'plpgsql'; LANGUAGE 'plpgsql';
-- table with single non-geometrical column -- check cartodbfytable idempotence
CREATE TABLE t AS SELECT 1::int as a; CREATE TABLE t AS SELECT 1::int as a;
SELECT CDB_CartodbfyTable('public', 't'); -- should fail SELECT CDB_CartodbfyTable('public', 't'); -- should fail
SELECT CDB_SetUserQuotaInBytes(0); -- Set user quota to infinite SELECT CDB_SetUserQuotaInBytes(0); -- Set user quota to infinite
SELECT CDB_CartodbfyTableCheck('t', 'single non-geometrical column'); SELECT CDB_CartodbfyTableCheck('t', 'single non-geometrical column');
DROP TABLE t; DROP TABLE t;
-- table with single non-geometrical column
CREATE TABLE t AS SELECT ST_SetSRID(ST_MakePoint(-1,-1),4326) as the_geom, 1::int as cartodb_id, 'this is a sentence' as description;
SELECT CDB_CartodbfyTableCheck('t', 'check function idempotence');
SELECT * FROM t;
SELECT CDB_CartodbfyTableCheck('t', 'check function idempotence');
SELECT * FROM t;
DROP TABLE t;
-- table with existing srid-unconstrained (but type-constrained) the_geom -- table with existing srid-unconstrained (but type-constrained) the_geom
CREATE TABLE t AS SELECT ST_SetSRID(ST_MakePoint(0,0),4326)::geometry(point) as the_geom; CREATE TABLE t AS SELECT ST_SetSRID(ST_MakePoint(0,0),4326)::geometry(point) as the_geom;
SELECT CDB_CartodbfyTableCheck('t', 'srid-unconstrained the_geom'); SELECT CDB_CartodbfyTableCheck('t', 'srid-unconstrained the_geom');

View File

@ -6,6 +6,12 @@ ERROR: Please set user quota before cartodbfying tables.
single non-geometrical column cartodbfied fine single non-geometrical column cartodbfied fine
DROP TABLE DROP TABLE
SELECT 1 SELECT 1
check function idempotence cartodbfied fine
1|0101000020E6100000000000000000F0BF000000000000F0BF|0101000020110F0000DB0B4ADA772DFBC046432E49D22DFBC0|this is a sentence
check function idempotence cartodbfied fine
1|0101000020E6100000000000000000F0BF000000000000F0BF|0101000020110F0000DB0B4ADA772DFBC046432E49D22DFBC0|this is a sentence
DROP TABLE
SELECT 1
srid-unconstrained the_geom cartodbfied fine srid-unconstrained the_geom cartodbfied fine
DROP TABLE DROP TABLE
SELECT 2 SELECT 2