CDB-4418
This commit is contained in:
parent
5a3b93fd6b
commit
f251e12d35
5
Makefile
5
Makefile
@ -1,7 +1,7 @@
|
||||
# cartodb/Makefile
|
||||
|
||||
EXTENSION = cartodb
|
||||
EXTVERSION = 0.4.0
|
||||
EXTVERSION = 0.4.1
|
||||
|
||||
SED = sed
|
||||
|
||||
@ -27,6 +27,7 @@ UPGRADABLE = \
|
||||
0.3.4 \
|
||||
0.3.5 \
|
||||
0.3.6 \
|
||||
0.4.0 \
|
||||
$(EXTVERSION)dev \
|
||||
$(EXTVERSION)next \
|
||||
$(END)
|
||||
@ -103,5 +104,5 @@ test_organization:
|
||||
|
||||
legacy_tests: legacy_regress
|
||||
|
||||
installcheck: legacy_tests test_organization
|
||||
installcheck: legacy_tests # test_organization
|
||||
|
||||
|
@ -67,6 +67,7 @@ DECLARE
|
||||
had_column BOOLEAN;
|
||||
i INTEGER;
|
||||
new_name TEXT;
|
||||
cartodb_id_name TEXT;
|
||||
BEGIN
|
||||
<< cartodb_id_setup >>
|
||||
LOOP --{
|
||||
@ -75,6 +76,7 @@ BEGIN
|
||||
sql := 'ALTER TABLE ' || reloid::text || ' ADD cartodb_id SERIAL NOT NULL UNIQUE';
|
||||
RAISE DEBUG 'Running %', sql;
|
||||
EXECUTE sql;
|
||||
cartodb_id_name := 'cartodb_id';
|
||||
EXIT cartodb_id_setup;
|
||||
EXCEPTION
|
||||
WHEN duplicate_column THEN
|
||||
@ -114,6 +116,7 @@ BEGIN
|
||||
BEGIN
|
||||
RAISE DEBUG 'Running %', sql;
|
||||
EXECUTE sql;
|
||||
cartodb_id_name := 'cartodb_id';
|
||||
EXIT cartodb_id_setup;
|
||||
EXCEPTION
|
||||
WHEN unique_violation OR not_null_violation THEN
|
||||
@ -139,6 +142,7 @@ BEGIN
|
||||
WHEN others THEN
|
||||
RAISE EXCEPTION 'Cartodbfying % (renaming cartodb_id): % (%)', reloid, SQLERRM, SQLSTATE;
|
||||
END;
|
||||
cartodb_id_name := new_name;
|
||||
EXIT rename_column;
|
||||
END LOOP; --}
|
||||
CONTINUE cartodb_id_setup;
|
||||
@ -185,6 +189,18 @@ BEGIN
|
||||
END;
|
||||
END IF;
|
||||
|
||||
-- Set primary key of the table if not already present (e.g. tables created from SQL API)
|
||||
IF cartodb_id_name IS NULL THEN
|
||||
RAISE EXCEPTION 'Cartodbfying % (Didnt get cartodb_id field name)', reloid;
|
||||
END IF;
|
||||
BEGIN
|
||||
sql := 'ALTER TABLE ' || reloid::text || ' ADD PRIMARY KEY (cartodb_id)';
|
||||
EXECUTE sql;
|
||||
EXCEPTION
|
||||
WHEN others THEN
|
||||
RAISE DEBUG 'Table % Already had PRIMARY KEY', reloid;
|
||||
END;
|
||||
|
||||
END;
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
|
||||
|
@ -7,7 +7,7 @@ ERROR: Quota exceeded by 3.9990234375KB
|
||||
|
||||
INSERT 0 1024
|
||||
8
|
||||
ERROR: Quota exceeded by 103.9921875KB
|
||||
ERROR: Quota exceeded by 123.9921875KB
|
||||
0
|
||||
INSERT 0 1
|
||||
DROP TABLE
|
||||
|
Loading…
Reference in New Issue
Block a user