Fix: Cartodbfication failed with existing PK

This fixes #174
When a unique index and a primary key contraint existed for a column
named cartodb_id cartodbfy tried to add another PK constraint
This commit is contained in:
Javier Goizueta
2015-11-20 12:56:52 +01:00
parent ea9503bd32
commit a0ca2288f4
3 changed files with 25 additions and 1 deletions

View File

@@ -319,6 +319,20 @@ SELECT CDB_CartodbfyTableCheck('test', 'Table with non unique and null cartodb_i
SELECT cartodb_id, cartodb_id_0 from test;
DROP TABLE test;
CREATE TABLE test (
cartodb_id integer
);
CREATE UNIQUE INDEX "test_cartodb_id_key" ON test (cartodb_id);
CREATE UNIQUE INDEX "test_cartodb_id_pkey" ON test (cartodb_id);
ALTER TABLE test ADD CONSTRAINT "test_pkey" PRIMARY KEY USING INDEX test_cartodb_id_pkey;
INSERT INTO test VALUES
(1),
(2),
(3);
SELECT CDB_CartodbfyTableCheck('test', 'Table with primary key and unique index on it #174');
SELECT cartodb_id from test;
DROP TABLE test;
CREATE TABLE test (
name varchar,
"first.value" integer,