Remove INCLUDE_IDENTITY_AS_SEQUENCE_DEFAULTS as it became obsolete

issue/6694
Gokhan Gulbiz 2023-03-15 15:51:51 +03:00
parent 9292ee8d9b
commit 212200f066
No known key found for this signature in database
GPG Key ID: 608EF06B6BD1B45B
3 changed files with 4 additions and 27 deletions

View File

@ -304,10 +304,7 @@ pg_get_sequencedef(Oid sequenceRelationId)
* When it's WORKER_NEXTVAL_SEQUENCE_DEFAULTS, the function creates the DEFAULT * When it's WORKER_NEXTVAL_SEQUENCE_DEFAULTS, the function creates the DEFAULT
* clause using worker_nextval('sequence') and not nextval('sequence') * clause using worker_nextval('sequence') and not nextval('sequence')
* When IncludeIdentities is NO_IDENTITY, the function does not include identity column * When IncludeIdentities is NO_IDENTITY, the function does not include identity column
* specifications. When it's INCLUDE_IDENTITY_AS_SEQUENCE_DEFAULTS, the function * specifications. When it's INCLUDE_IDENTITY it creates GENERATED .. AS IDENTIY clauses.
* uses sequences and set them as default values for identity columns by using exactly
* the same approach with worker_nextval('sequence') & nextval('sequence') logic
* desribed above. When it's INCLUDE_IDENTITY it creates GENERATED .. AS IDENTIY clauses.
*/ */
char * char *
pg_get_tableschemadef_string(Oid tableRelationId, IncludeSequenceDefaults pg_get_tableschemadef_string(Oid tableRelationId, IncludeSequenceDefaults
@ -403,23 +400,7 @@ pg_get_tableschemadef_string(Oid tableRelationId, IncludeSequenceDefaults
Oid seqOid = getIdentitySequence(RelationGetRelid(relation), Oid seqOid = getIdentitySequence(RelationGetRelid(relation),
attributeForm->attnum, missing_ok); attributeForm->attnum, missing_ok);
char *sequenceName = generate_qualified_relation_name(seqOid); if (includeIdentityDefaults == INCLUDE_IDENTITY)
if (includeIdentityDefaults == INCLUDE_IDENTITY_AS_SEQUENCE_DEFAULTS)
{
if (pg_get_sequencedef(seqOid)->seqtypid != INT8OID)
{
appendStringInfo(&buffer,
" DEFAULT worker_nextval(%s::regclass)",
quote_literal_cstr(sequenceName));
}
else
{
appendStringInfo(&buffer, " DEFAULT nextval(%s::regclass)",
quote_literal_cstr(sequenceName));
}
}
else if (includeIdentityDefaults == INCLUDE_IDENTITY)
{ {
Form_pg_sequence pgSequenceForm = pg_get_sequencedef(seqOid); Form_pg_sequence pgSequenceForm = pg_get_sequencedef(seqOid);
char *sequenceDef = psprintf( char *sequenceDef = psprintf(

View File

@ -461,10 +461,7 @@ ResolveRelationId(text *relationName, bool missingOk)
* definition, optional column storage and statistics definitions, and index * definition, optional column storage and statistics definitions, and index
* constraint and trigger definitions. * constraint and trigger definitions.
* When IncludeIdentities is NO_IDENTITY, the function does not include identity column * When IncludeIdentities is NO_IDENTITY, the function does not include identity column
* specifications. When it's INCLUDE_IDENTITY_AS_SEQUENCE_DEFAULTS, the function * specifications. When it's INCLUDE_IDENTITY it creates GENERATED .. AS IDENTIY clauses.
* uses sequences and set them as default values for identity columns by using exactly
* the same approach with worker_nextval('sequence') & nextval('sequence') logic
* desribed above. When it's INCLUDE_IDENTITY it creates GENERATED .. AS IDENTIY clauses.
*/ */
List * List *
GetFullTableCreationCommands(Oid relationId, GetFullTableCreationCommands(Oid relationId,

View File

@ -124,8 +124,7 @@ typedef enum IncludeSequenceDefaults
typedef enum IncludeIdentities typedef enum IncludeIdentities
{ {
NO_IDENTITY = 0, /* don't include identities */ NO_IDENTITY = 0, /* don't include identities */
INCLUDE_IDENTITY_AS_SEQUENCE_DEFAULTS = 1, /* include identities as sequences */ INCLUDE_IDENTITY = 1 /* include identities as-is*/
INCLUDE_IDENTITY = 2 /* include identities as-is*/
} IncludeIdentities; } IncludeIdentities;