/*
* seqam_init - initialize/replace custom sequence am values
*/
-extern void
+void
seqam_init(Oid seqamid, Oid seqrelid, List *seqparams, List *reloptions,
Datum *values, bool *nulls)
{
sequence_check_range(last_value, min_value, max_value);
/*
- * If this is new sequence or RESTART was provided in ALTER we should
+ * If this is a new sequence or RESTART was provided in ALTER we should
* reset our state to that new starting point.
*/
if (seqrelid == InvalidOid || found_restart)
/* We might need to fetch even more values for our own caching. */
if (rescnt < fetch)
rescnt += sequence_increment(seqrel, &next, fetch - rescnt, minv,
- maxv, incby, is_cycled, false);
+ maxv, incby, is_cycled, false);
fetch -= rescnt;
log -= fetch; /* adjust for any unfetched numbers */
SeqTable elm;
Relation rel;
Buffer buf;
- HeapTupleData tup;
+ HeapTupleData tup;
};
/*
return result;
}
-
Datum
currval_oid(PG_FUNCTION_ARGS)
{
* Given a relation OID, open and share-lock the sequence.
*/
void
-sequence_open(Oid seqrelid, SequenceHandle *seqh)
+sequence_open(Oid relid, SequenceHandle *seqh)
{
- SeqTable elm;
- Relation seqrel;
- bool found;
+ SeqTable elm;
+ Relation seqrel;
+ bool found;
/* Find or create a hash table entry for this sequence */
if (seqhashtab == NULL)
create_seq_hashtable();
- elm = (SeqTable) hash_search(seqhashtab, &seqrelid, HASH_ENTER, &found);
+ elm = (SeqTable) hash_search(seqhashtab, &relid, HASH_ENTER, &found);
/*
* Initialize the new hash table entry if it did not exist already.
lp = PageGetItemId(page, FirstOffsetNumber);
Assert(ItemIdIsNormal(lp));
- /* Note we currently only bother to set these two fields of seqh->tup */
+ /* Note we currently only bother to set these two fields of the tuple */
seqh->tup.t_data = (HeapTupleHeader) PageGetItem(page, lp);
seqh->tup.t_len = ItemIdGetLength(lp);