Commit 0e39c8ac authored by Philip Warner's avatar Philip Warner

Added some comments to setval, setval_is_called and do_setval

parent 4a19bd87
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.49 2001/01/24 19:42:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.50 2001/02/13 01:57:12 pjw Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -374,6 +374,19 @@ currval(PG_FUNCTION_ARGS) ...@@ -374,6 +374,19 @@ currval(PG_FUNCTION_ARGS)
PG_RETURN_INT32(result); PG_RETURN_INT32(result);
} }
/*
* Main internal procedure that handles 2 & 3 arg forms of SETVAL.
*
* Note that the 3 arg version (which sets the is_called flag) is
* only for use in pg_dump, and setting the is_called flag may not
* work if multiple users are attached to the database and referencing
* the sequence (unlikely if pg_dump is restoring it).
*
* It is necessary to have the 3 arg version so that pg_dump can
* restore the state of a sequence exactly during data-only restores -
* it is the only way to clear the is_called flag in an existing
* sequence.
*/
static void static void
do_setval(char *seqname, int32 next, bool iscalled) do_setval(char *seqname, int32 next, bool iscalled)
{ {
...@@ -440,6 +453,10 @@ do_setval(char *seqname, int32 next, bool iscalled) ...@@ -440,6 +453,10 @@ do_setval(char *seqname, int32 next, bool iscalled)
} }
/*
* Implement the 2 arg setval procedure.
* See do_setval for discussion.
*/
Datum Datum
setval(PG_FUNCTION_ARGS) setval(PG_FUNCTION_ARGS)
{ {
...@@ -452,6 +469,10 @@ setval(PG_FUNCTION_ARGS) ...@@ -452,6 +469,10 @@ setval(PG_FUNCTION_ARGS)
PG_RETURN_INT32(next); PG_RETURN_INT32(next);
} }
/*
* Implement the 3 arg setval procedure.
* See do_setval for discussion.
*/
Datum Datum
setval_and_iscalled(PG_FUNCTION_ARGS) setval_and_iscalled(PG_FUNCTION_ARGS)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment