Fixes NULL max in rec 155
This commit is contained in:
parent
453b3af872
commit
081ed36aae
@ -157,7 +157,7 @@ BEGIN
|
||||
EXECUTE sql;
|
||||
|
||||
-- Find max value
|
||||
sql := Format('SELECT max(cartodb_id) FROM %s', reloid::text);
|
||||
sql := Format('SELECT coalesce(max(cartodb_id), 0) as max FROM %s', reloid::text);
|
||||
RAISE DEBUG 'Running %', sql;
|
||||
EXECUTE sql INTO rec;
|
||||
|
||||
@ -166,7 +166,7 @@ BEGIN
|
||||
AS seq INTO rec2;
|
||||
|
||||
-- Reset sequence name
|
||||
sql := Format('ALTER SEQUENCE %s RESTART WITH %', rec2.seq::text, rec.max + 1);
|
||||
sql := Format('ALTER SEQUENCE %s RESTART WITH %s', rec2.seq::text, rec.max + 1);
|
||||
RAISE DEBUG 'Running %', sql;
|
||||
EXECUTE sql;
|
||||
|
||||
|
@ -319,7 +319,7 @@ SELECT CDB_CartodbfyTableCheck('test', 'Table with non unique and null cartodb_i
|
||||
SELECT cartodb_id, cartodb_id_0 from test;
|
||||
DROP TABLE test;
|
||||
|
||||
-- _CDB_create_cartodb_id_column with cartodb_id already present
|
||||
-- _CDB_create_cartodb_id_column with cartodb_id integer already present
|
||||
CREATE TABLE test (cartodb_id integer);
|
||||
|
||||
SELECT _CDB_Create_Cartodb_ID_Column('test'::regclass);
|
||||
@ -327,6 +327,14 @@ SELECT column_name FROM information_schema.columns WHERE table_name = 'test' AND
|
||||
|
||||
DROP TABLE test;
|
||||
|
||||
-- _CDB_create_cartodb_id_column with cartodb_id text already present
|
||||
CREATE TABLE test (cartodb_id text);
|
||||
|
||||
SELECT _CDB_Create_Cartodb_ID_Column('test'::regclass);
|
||||
SELECT column_name FROM information_schema.columns WHERE table_name = 'test' AND column_name = '_cartodb_id0';
|
||||
|
||||
DROP TABLE test;
|
||||
|
||||
-- TODO: table with existing custom-triggered the_geom
|
||||
|
||||
DROP FUNCTION CDB_CartodbfyTableCheck(regclass, text);
|
||||
|
@ -104,6 +104,9 @@ Table with non unique and null cartodb_id #148 cartodbfied fine
|
||||
DROP TABLE
|
||||
CREATE TABLE
|
||||
|
||||
DROP TABLE
|
||||
CREATE TABLE
|
||||
|
||||
_cartodb_id0
|
||||
DROP TABLE
|
||||
DROP FUNCTION
|
||||
|
Loading…
Reference in New Issue
Block a user