From: Heikki Linnakangas Date: Mon, 20 Apr 2015 10:01:09 +0000 (+0300) Subject: Minor simplification: inline helper function X-Git-Url: http://git.postgresql.org/gitweb/review?a=commitdiff_plain;h=1e37b2e992d4822a11c1bc8c60341e075815e735;p=users%2Fheikki%2Fpostgres.git Minor simplification: inline helper function --- diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 1089e40d1d..bb05bb3273 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -104,7 +104,6 @@ static void process_owned_by(Relation seqrel, List *owned_by); static void log_sequence_tuple(Relation seqrel, HeapTuple tuple, Buffer buf, Page page); static void seqrel_update_relam(Oid seqoid, Oid seqamid); -static Oid get_new_seqam_oid(Oid oldAM, char *accessMethod); /* @@ -244,7 +243,10 @@ DefineSequence(CreateSeqStmt *seq) stmt->if_not_exists = seq->if_not_exists; /* Let AM fill the values[] and nulls[] for the tuple as well. */ - seqamid = get_new_seqam_oid(InvalidOid, seq->accessMethod); + if (seq->accessMethod) + seqamid = get_seqam_oid(seq->accessMethod, false); + else + seqamid = LOCAL_SEQAM_OID; seqam_init(seqamid, InvalidOid, seq->options, seq->amoptions, value, null); @@ -480,11 +482,13 @@ AlterSequence(AlterSeqStmt *stmt) heap_deform_tuple(tuple, tupDesc, values, nulls); oldamid = seqrel->rd_rel->relam; - seqamid = get_new_seqam_oid(seqrel->rd_rel->relam, stmt->accessMethod); + if (stmt->accessMethod) + seqamid = get_seqam_oid(stmt->accessMethod, false); + else + seqamid = oldamid; /* - * If we are changing sequence AM, we need to alter - * the sequence relation. + * If we are changing sequence AM, we need to alter the sequence relation. */ if (seqamid != oldamid) { @@ -1733,18 +1737,6 @@ ResetSequenceCaches(void) last_used_seq = NULL; } -static Oid -get_new_seqam_oid(Oid oldAM, char *accessMethod) -{ - - if (oldAM && accessMethod == NULL) - return oldAM; - else if (accessMethod == NULL) - return LOCAL_SEQAM_OID; - else - return get_seqam_oid(accessMethod, false); -} - /* * Increment sequence while correctly handling overflows and min/max. */