issue/6694
Gokhan Gulbiz 2023-02-28 15:12:08 +03:00
parent e684e15e40
commit 9e45f8c6b7
No known key found for this signature in database
GPG Key ID: 608EF06B6BD1B45B
4 changed files with 14 additions and 11 deletions

View File

@ -1541,6 +1541,7 @@ CreateMaterializedViewDDLCommand(Oid matViewOid)
return query->data;
}
/*
* ReplaceTable replaces the source table with the target table.
* It moves all the rows of the source table to target table with INSERT SELECT.

View File

@ -1805,8 +1805,6 @@ ErrorIfTableIsACatalogTable(Relation relation)
}
/*
* This function marks all the identity sequences as distributed on the given table.
*/
@ -1842,15 +1840,13 @@ MarkIdentitiesAsDistributed(Oid targetRelationId)
char *tableName = generate_qualified_relation_name(targetRelationId);
appendStringInfo(stringInfo,
WORKER_MODIFY_IDENTITY_COMMAND,
quote_literal_cstr(tableName));
WORKER_MODIFY_IDENTITY_COMMAND,
quote_literal_cstr(tableName));
SendCommandToWorkersWithMetadata(stringInfo->data);
}
}
/*
* EnsureLocalTableEmptyIfNecessary errors out if the function should be empty
* according to ShouldLocalTableBeEmpty but it is not.

View File

@ -3991,11 +3991,13 @@ ErrorIfTableHasUnsupportedIdentityColumn(Oid relationId)
if (attributeForm->attidentity && attributeForm->atttypid != INT8OID)
{
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot complete operation on a table with smallint/int identity column")));
errmsg(
"cannot complete operation on a table with smallint/int identity column")));
}
}
}
/*
* ErrorIfTableHasIdentityColumn errors out if the given table has identity column
*/
@ -4014,7 +4016,8 @@ ErrorIfTableHasIdentityColumn(Oid relationId)
if (attributeForm->attidentity)
{
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot complete operation on a table with identity column")));
errmsg(
"cannot complete operation on a table with identity column")));
}
}
}

View File

@ -133,6 +133,7 @@ worker_apply_inter_shard_ddl_command(PG_FUNCTION_ARGS)
PG_RETURN_VOID();
}
/*
* worker_modify_identity_columns takes a table oid, runs an ALTER SEQUENCE statement
* for each identity column to adjust the minvalue and maxvalue of the sequence owned by
@ -160,21 +161,23 @@ worker_modify_identity_columns(PG_FUNCTION_ARGS)
if (attributeForm->attidentity)
{
Oid sequenceOid = getIdentitySequence(tableRelationId,
attributeForm->attnum,
missingSequenceOk);
attributeForm->attnum,
missingSequenceOk);
Oid sequenceSchemaOid = get_rel_namespace(sequenceOid);
char *sequenceSchemaName = get_namespace_name(sequenceSchemaOid);
char *sequenceName = get_rel_name(sequenceOid);
Oid sequenceTypeId = pg_get_sequencedef(sequenceOid)->seqtypid;
AlterSequenceMinMax(sequenceOid, sequenceSchemaName, sequenceName, sequenceTypeId);
AlterSequenceMinMax(sequenceOid, sequenceSchemaName, sequenceName,
sequenceTypeId);
}
}
PG_RETURN_VOID();
}
/*
* worker_apply_sequence_command takes a CREATE SEQUENCE command string, runs the
* CREATE SEQUENCE command then creates and runs an ALTER SEQUENCE statement