8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.49 2001/01/24 19:42:53 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.50 2001/02/13 01:57:12 pjw Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -374,6 +374,19 @@ currval(PG_FUNCTION_ARGS)
374
374
PG_RETURN_INT32 (result );
375
375
}
376
376
377
+ /*
378
+ * Main internal procedure that handles 2 & 3 arg forms of SETVAL.
379
+ *
380
+ * Note that the 3 arg version (which sets the is_called flag) is
381
+ * only for use in pg_dump, and setting the is_called flag may not
382
+ * work if multiple users are attached to the database and referencing
383
+ * the sequence (unlikely if pg_dump is restoring it).
384
+ *
385
+ * It is necessary to have the 3 arg version so that pg_dump can
386
+ * restore the state of a sequence exactly during data-only restores -
387
+ * it is the only way to clear the is_called flag in an existing
388
+ * sequence.
389
+ */
377
390
static void
378
391
do_setval (char * seqname , int32 next , bool iscalled )
379
392
{
@@ -440,6 +453,10 @@ do_setval(char *seqname, int32 next, bool iscalled)
440
453
441
454
}
442
455
456
+ /*
457
+ * Implement the 2 arg setval procedure.
458
+ * See do_setval for discussion.
459
+ */
443
460
Datum
444
461
setval (PG_FUNCTION_ARGS )
445
462
{
@@ -452,6 +469,10 @@ setval(PG_FUNCTION_ARGS)
452
469
PG_RETURN_INT32 (next );
453
470
}
454
471
472
+ /*
473
+ * Implement the 3 arg setval procedure.
474
+ * See do_setval for discussion.
475
+ */
455
476
Datum
456
477
setval_and_iscalled (PG_FUNCTION_ARGS )
457
478
{
0 commit comments