Recover usage of cartodb id if has_usable_primary_key #138

This commit is contained in:
Rafa de la Torre
2015-09-10 18:20:52 +02:00
parent 85b206fdba
commit 7a247c1ab2

View File

@@ -964,7 +964,11 @@ BEGIN
sql := Format('CREATE TABLE %s AS SELECT ', copyname);
-- Add cartodb ID!
sql := sql || 'nextval(''' || destseq || ''') AS ' || const.pkey;
IF has_usable_primary_key THEN
sql := sql || const.pkey;
ELSE
sql := sql || 'nextval(''' || destseq || ''') AS ' || const.pkey;
END IF;
-- Add the geometry columns!
IF gc.has_usable_geoms THEN