Merge pull request #175 from CartoDB/155-fix-wrong-delimiters
Removes extra d in delimiter 155
This commit is contained in:
@@ -152,12 +152,12 @@ BEGIN
|
||||
-- Copy existing values to new field
|
||||
-- NOTE: using ALTER is a workaround to a PostgreSQL bug and is also known to be faster for tables with many rows
|
||||
-- See http://www.postgresql.org/message-id/20140530143150.GA11051@localhost
|
||||
sql := Format('ALTER TABLE %s ALTER cartodb_id TYPE int USING %I', reloid::text, new_name);
|
||||
sql := Format('ALTER TABLE %s ALTER cartodb_id TYPE int USING %I::integer', reloid::text, new_name);
|
||||
RAISE DEBUG 'Running %', sql;
|
||||
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 %d', 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,6 +319,23 @@ SELECT CDB_CartodbfyTableCheck('test', 'Table with non unique and null cartodb_i
|
||||
SELECT cartodb_id, cartodb_id_0 from test;
|
||||
DROP TABLE test;
|
||||
|
||||
SET client_min_messages TO notice;
|
||||
-- _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);
|
||||
SELECT column_name FROM information_schema.columns WHERE table_name = 'test' AND column_name = '_cartodb_id0';
|
||||
|
||||
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;
|
||||
SET client_min_messages TO error;
|
||||
|
||||
-- TODO: table with existing custom-triggered the_geom
|
||||
|
||||
|
||||
@@ -102,5 +102,19 @@ Table with non unique and null cartodb_id #148 cartodbfied fine
|
||||
3|
|
||||
4|2
|
||||
DROP TABLE
|
||||
SET
|
||||
CREATE TABLE
|
||||
NOTICE: Column cartodb_id already exists
|
||||
NOTICE: Existing cartodb_id field does not have an associated sequence, renaming
|
||||
NOTICE: Trying to recover data from _cartodb_id0 column
|
||||
|
||||
DROP TABLE
|
||||
CREATE TABLE
|
||||
NOTICE: Column cartodb_id already exists
|
||||
NOTICE: Existing cartodb_id field is of invalid type text (need int2, int4 or int8), renaming
|
||||
NOTICE: Trying to recover data from _cartodb_id0 column
|
||||
|
||||
DROP TABLE
|
||||
SET
|
||||
DROP FUNCTION
|
||||
DROP FUNCTION
|
||||
|
||||
Reference in New Issue
Block a user