Merge branch 'master' into quantiles-bins-updates
This commit is contained in:
commit
697a0a3a36
3
NEWS.md
3
NEWS.md
@ -1,4 +1,5 @@
|
|||||||
0.22.0 (TBD)
|
0.22.0 (yyyy-mm-dd)
|
||||||
|
* Fix: allow older ogr2ogr to work in -append mode (#319)
|
||||||
* Refactors CDB_QuantileBins to rely on PostgreSQL function `percentile_disc` #316
|
* Refactors CDB_QuantileBins to rely on PostgreSQL function `percentile_disc` #316
|
||||||
|
|
||||||
0.21.0 (2018-02-15)
|
0.21.0 (2018-02-15)
|
||||||
|
@ -791,6 +791,7 @@ DECLARE
|
|||||||
|
|
||||||
relname TEXT;
|
relname TEXT;
|
||||||
relschema TEXT;
|
relschema TEXT;
|
||||||
|
relseq TEXT;
|
||||||
|
|
||||||
destoid REGCLASS;
|
destoid REGCLASS;
|
||||||
destname TEXT;
|
destname TEXT;
|
||||||
@ -897,7 +898,22 @@ BEGIN
|
|||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- We must rewrite, so here we go...
|
-- We must rewrite, so here we go...
|
||||||
|
|
||||||
|
-- Our desired PK sequence name
|
||||||
|
|
||||||
|
-- We are going to drop the source table when we're done anyways
|
||||||
|
-- but it's possible the source PK sequence is living in a name we would like to use
|
||||||
|
-- so we check to see if that's the case, and rename it out of the way
|
||||||
|
IF has_usable_primary_key AND has_usable_pk_sequence THEN
|
||||||
|
-- See if the existing sequence is squatting on our preferred name
|
||||||
|
destseq := Format('%s_%s_seq', relname, const.pkey);
|
||||||
|
SELECT pg_catalog.pg_get_serial_sequence(Format('%I.%I', relschema, relname), const.pkey)
|
||||||
|
INTO relseq;
|
||||||
|
-- If it's the name we want, then rename it
|
||||||
|
IF relseq IS NOT NULL AND relseq = Format('%I.%I', destschema, destseq) THEN
|
||||||
|
PERFORM _CDB_SQL(Format('ALTER SEQUENCE %s RENAME TO %s_tmp', relseq, destseq), '_CDB_Rewrite_Table');
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
-- Put the primary key sequence in the right schema
|
-- Put the primary key sequence in the right schema
|
||||||
-- If the new table is not moving, better ensure the sequence name
|
-- If the new table is not moving, better ensure the sequence name
|
||||||
|
Loading…
Reference in New Issue
Block a user