Skip to content

Commit cd603a4

Browse files
committed
Use SQL standard error code for nextval
1 parent be37c21 commit cd603a4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/backend/commands/sequence.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ nextval_internal(Oid relid)
694694

695695
snprintf(buf, sizeof(buf), INT64_FORMAT, maxv);
696696
ereport(ERROR,
697-
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
697+
(errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED),
698698
errmsg("nextval: reached maximum value of sequence \"%s\" (%s)",
699699
RelationGetRelationName(seqrel), buf)));
700700
}
@@ -717,7 +717,7 @@ nextval_internal(Oid relid)
717717

718718
snprintf(buf, sizeof(buf), INT64_FORMAT, minv);
719719
ereport(ERROR,
720-
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
720+
(errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED),
721721
errmsg("nextval: reached minimum value of sequence \"%s\" (%s)",
722722
RelationGetRelationName(seqrel), buf)));
723723
}

src/backend/utils/errcodes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ Section: Class 22 - Data Exception
188188
22004 E ERRCODE_NULL_VALUE_NOT_ALLOWED null_value_not_allowed
189189
22002 E ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER null_value_no_indicator_parameter
190190
22003 E ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE numeric_value_out_of_range
191+
2200H E ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED sequence_generator_limit_exceeded
191192
22026 E ERRCODE_STRING_DATA_LENGTH_MISMATCH string_data_length_mismatch
192193
22001 E ERRCODE_STRING_DATA_RIGHT_TRUNCATION string_data_right_truncation
193194
22011 E ERRCODE_SUBSTRING_ERROR substring_error

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy