Try to retain existing cartodb_id values
Also reset sequence when original cartodb_id values correctly cast to integers, and does not keep a backup in that case. Closes #27
This commit is contained in:
@@ -178,6 +178,18 @@ SELECT CDB_CartodbfyTableCheck('t', 'text timestamps');
|
||||
SELECT reftime-created_at, reftime-updated_at FROM t;
|
||||
DROP TABLE t;
|
||||
|
||||
-- table with existing cartodb_id field ot type text
|
||||
CREATE TABLE t AS SELECT 10::text as cartodb_id;
|
||||
SELECT CDB_CartodbfyTableCheck('t', 'text cartodb_id');
|
||||
select cartodb_id/2 FROM t;
|
||||
DROP TABLE t;
|
||||
|
||||
-- table with existing cartodb_id field ot type text not casting
|
||||
CREATE TABLE t AS SELECT 'nan' as cartodb_id;
|
||||
SELECT CDB_CartodbfyTableCheck('t', 'uncasting text cartodb_id');
|
||||
select cartodb_id,_cartodb_id0 FROM t;
|
||||
DROP TABLE t;
|
||||
|
||||
-- TODO: table with existing custom-triggered the_geom
|
||||
|
||||
DROP FUNCTION CDB_CartodbfyTableCheck(regclass, text);
|
||||
|
||||
@@ -29,5 +29,13 @@ SELECT 1
|
||||
text timestamps cartodbfied fine
|
||||
@ 0|@ 0
|
||||
DROP TABLE
|
||||
SELECT 1
|
||||
text cartodb_id cartodbfied fine
|
||||
5
|
||||
DROP TABLE
|
||||
SELECT 1
|
||||
uncasting text cartodb_id cartodbfied fine
|
||||
1|nan
|
||||
DROP TABLE
|
||||
DROP FUNCTION
|
||||
DROP FUNCTION
|
||||
|
||||
Reference in New Issue
Block a user