aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/sequence.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-12-08 20:06:58 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-12-08 20:06:58 +0000
commitb44e46cfcea288c3f404b4da4456b9736b057a38 (patch)
tree99ba14f5711a398bb3de0571d103d1f38d74a8e1 /src/backend/commands/sequence.c
parentce1748406b5fcdd52eb9f7ad49dda823f1a021c4 (diff)
downloadpostgresql-b44e46cfcea288c3f404b4da4456b9736b057a38.tar.gz
postgresql-b44e46cfcea288c3f404b4da4456b9736b057a38.zip
Remove error check that disallowed setval() on a sequence with cache
value greater than one. The behavior this sought to disallow doesn't seem any less confusing than the other behaviors of cached sequences. Improve wording of some error messages, too. Update documentation accordingly. Also add an explanation that aborted transactions do not roll back their nextval() calls; this seems to be a FAQ, so it ought to be mentioned here...
Diffstat (limited to 'src/backend/commands/sequence.c')
-rw-r--r--src/backend/commands/sequence.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index ca73318dc54..bb9659f359c 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -257,7 +257,7 @@ nextval(PG_FUNCTION_ARGS)
if (rescnt > 0)
break; /* stop fetching */
if (seq->is_cycled != 't')
- elog(ERROR, "%s.nextval: got MAXVALUE (%d)",
+ elog(ERROR, "%s.nextval: reached MAXVALUE (%d)",
elm->name, maxv);
next = minv;
}
@@ -273,7 +273,7 @@ nextval(PG_FUNCTION_ARGS)
if (rescnt > 0)
break; /* stop fetching */
if (seq->is_cycled != 't')
- elog(ERROR, "%s.nextval: got MINVALUE (%d)",
+ elog(ERROR, "%s.nextval: reached MINVALUE (%d)",
elm->name, minv);
next = maxv;
}
@@ -371,21 +371,13 @@ do_setval(char *seqname, int32 next, bool iscalled)
seq = read_info("setval", elm, &buf); /* lock page' buffer and
* read tuple */
- if (seq->cache_value != 1)
- {
- elog(ERROR, "%s.setval: can't set value of sequence %s, cache != 1",
- seqname, seqname);
- }
-
if ((next < seq->min_value) || (next > seq->max_value))
- {
- elog(ERROR, "%s.setval: value %d is of of bounds (%d,%d)",
+ elog(ERROR, "%s.setval: value %d is out of bounds (%d,%d)",
seqname, next, seq->min_value, seq->max_value);
- }
/* save info in local cache */
elm->last = next; /* last returned number */
- elm->cached = next; /* last cached number */
+ elm->cached = next; /* last cached number (forget cached values) */
/* save info in sequence relation */
START_CRIT_CODE;
@@ -540,7 +532,7 @@ init_sequence(char *caller, char *name)
/* Else open and check it */
seqrel = heap_openr(name, AccessShareLock);
if (seqrel->rd_rel->relkind != RELKIND_SEQUENCE)
- elog(ERROR, "%s.%s: %s is not sequence !", name, caller, name);
+ elog(ERROR, "%s.%s: %s is not a sequence", name, caller, name);
if (elm != (SeqTable) NULL)
{
@@ -704,7 +696,7 @@ get_param(DefElem *def)
if (nodeTag(def->arg) == T_Integer)
return intVal(def->arg);
- elog(ERROR, "DefineSequence: \"%s\" is to be integer", def->defname);
+ elog(ERROR, "DefineSequence: \"%s\" value must be integer", def->defname);
return -1;
}