Adds ::integer cast for USING 155

pull/175/head
Guido Fioravantti 9 years ago
parent 7cf0d02935
commit cce63f0eae

@ -152,7 +152,7 @@ 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;

@ -113,7 +113,6 @@ 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
NOTICE: Could not initialize cartodb_id with existing values: result of USING clause for column "cartodb_id" cannot be cast automatically to type integer (42804)
_cartodb_id0
DROP TABLE

Loading…
Cancel
Save