From: Tomas Vondra Date: Thu, 19 Jan 2017 09:40:01 +0000 (+0100) Subject: skip RenameSequenceGTM() for SET SCHEMA with the same schema X-Git-Tag: XL_10_R1BETA1~447 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=82f52a7876c4257d13cb22a733656ca7a9232b38;p=postgres-xl.git skip RenameSequenceGTM() for SET SCHEMA with the same schema Commit bc4996e6 in upstream changed how CheckSetNamespace() handles moving to the same namespace, e.g. when executing ALTER SEQUENCE s1.s SET SCHEMA s1; On PostgreSQL 9.5 this fails with an error, but since bc4996e6 the command is silently ignored (which was already the case for other object types - ALTER EXTENSION etc). XL however relied on the ERROR interrupting the program flow before the call to RenameSequenceGTM(), so after bc4996e6 it was executed anyway. GTM however does not expect unnecessary sequence renames, and treats this as an error in seq_add_seqinfo. --- diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 2daeb6403e..ecaa7c32a0 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -12124,7 +12124,8 @@ AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid, /* Rename also sequence on GTM for a sequence */ if (IS_PGXC_LOCAL_COORDINATOR && rel->rd_rel->relkind == RELKIND_SEQUENCE && - !IsTempSequence(RelationGetRelid(rel))) + !IsTempSequence(RelationGetRelid(rel)) && + (oldNspOid != nspOid)) { char *seqname = GetGlobalSeqName(rel, NULL, NULL); char *newseqname = GetGlobalSeqName(rel, NULL, get_namespace_name(nspOid)); @@ -12333,7 +12334,8 @@ AlterSeqNamespaces(Relation classRel, Relation rel, #ifdef PGXC /* Change also this sequence name on GTM */ if (IS_PGXC_LOCAL_COORDINATOR && - !IsTempSequence(RelationGetRelid(seqRel))) + !IsTempSequence(RelationGetRelid(seqRel)) && + (oldNspOid != newNspOid)) { char *seqname = GetGlobalSeqName(seqRel, NULL, NULL); char *newseqname = GetGlobalSeqName(seqRel, NULL, get_namespace_name(newNspOid));