Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0e39c8a

Browse files
committed
Added some comments to setval, setval_is_called and do_setval
1 parent 4a19bd8 commit 0e39c8a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/backend/commands/sequence.c

+22-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* 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 $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -374,6 +374,19 @@ currval(PG_FUNCTION_ARGS)
374374
PG_RETURN_INT32(result);
375375
}
376376

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+
*/
377390
static void
378391
do_setval(char *seqname, int32 next, bool iscalled)
379392
{
@@ -440,6 +453,10 @@ do_setval(char *seqname, int32 next, bool iscalled)
440453

441454
}
442455

456+
/*
457+
* Implement the 2 arg setval procedure.
458+
* See do_setval for discussion.
459+
*/
443460
Datum
444461
setval(PG_FUNCTION_ARGS)
445462
{
@@ -452,6 +469,10 @@ setval(PG_FUNCTION_ARGS)
452469
PG_RETURN_INT32(next);
453470
}
454471

472+
/*
473+
* Implement the 3 arg setval procedure.
474+
* See do_setval for discussion.
475+
*/
455476
Datum
456477
setval_and_iscalled(PG_FUNCTION_ARGS)
457478
{

0 commit comments

Comments
 (0)