Commit 12f87b2c authored by Peter Eisentraut's avatar Peter Eisentraut

Add new SQL:2008 error codes for invalid LIMIT and OFFSET values. Remove

unused nonstandard error code that was perhaps intended for this but never
used.
parent 9add9f95
<!-- $PostgreSQL: pgsql/doc/src/sgml/errcodes.sgml,v 1.26 2008/12/28 18:53:53 tgl Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/errcodes.sgml,v 1.27 2009/03/04 10:55:00 petere Exp $ -->
<appendix id="errcodes-appendix"> <appendix id="errcodes-appendix">
<title><productname>PostgreSQL</productname> Error Codes</title> <title><productname>PostgreSQL</productname> Error Codes</title>
...@@ -444,12 +444,6 @@ ...@@ -444,12 +444,6 @@
<entry>invalid_indicator_parameter_value</entry> <entry>invalid_indicator_parameter_value</entry>
</row> </row>
<row>
<entry><literal>22020</literal></entry>
<entry>INVALID LIMIT VALUE</entry>
<entry>invalid_limit_value</entry>
</row>
<row> <row>
<entry><literal>22023</literal></entry> <entry><literal>22023</literal></entry>
<entry>INVALID PARAMETER VALUE</entry> <entry>INVALID PARAMETER VALUE</entry>
...@@ -462,6 +456,18 @@ ...@@ -462,6 +456,18 @@
<entry>invalid_regular_expression</entry> <entry>invalid_regular_expression</entry>
</row> </row>
<row>
<entry><literal>2201W</literal></entry>
<entry>INVALID ROW COUNT IN LIMIT CLAUSE</entry>
<entry>invalid_row_count_in_limit_clause</entry>
</row>
<row>
<entry><literal>2201X</literal></entry>
<entry>INVALID ROW COUNT IN RESULT OFFSET CLAUSE</entry>
<entry>invalid_row_count_in_result_offset_clause</entry>
</row>
<row> <row>
<entry><literal>22009</literal></entry> <entry><literal>22009</literal></entry>
<entry>INVALID TIME ZONE DISPLACEMENT VALUE</entry> <entry>INVALID TIME ZONE DISPLACEMENT VALUE</entry>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.35 2009/01/01 17:23:41 momjian Exp $ * $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.36 2009/03/04 10:55:00 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -247,7 +247,7 @@ recompute_limits(LimitState *node) ...@@ -247,7 +247,7 @@ recompute_limits(LimitState *node)
node->offset = DatumGetInt64(val); node->offset = DatumGetInt64(val);
if (node->offset < 0) if (node->offset < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE),
errmsg("OFFSET must not be negative"))); errmsg("OFFSET must not be negative")));
} }
} }
...@@ -274,7 +274,7 @@ recompute_limits(LimitState *node) ...@@ -274,7 +274,7 @@ recompute_limits(LimitState *node)
node->count = DatumGetInt64(val); node->count = DatumGetInt64(val);
if (node->count < 0) if (node->count < 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE),
errmsg("LIMIT must not be negative"))); errmsg("LIMIT must not be negative")));
node->noCount = false; node->noCount = false;
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Copyright (c) 2003-2009, PostgreSQL Global Development Group * Copyright (c) 2003-2009, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/include/utils/errcodes.h,v 1.28 2009/01/01 17:24:02 momjian Exp $ * $PostgreSQL: pgsql/src/include/utils/errcodes.h,v 1.29 2009/03/04 10:55:00 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -133,9 +133,10 @@ ...@@ -133,9 +133,10 @@
#define ERRCODE_INVALID_ESCAPE_SEQUENCE MAKE_SQLSTATE('2','2', '0','2','5') #define ERRCODE_INVALID_ESCAPE_SEQUENCE MAKE_SQLSTATE('2','2', '0','2','5')
#define ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2', 'P','0','6') #define ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2', 'P','0','6')
#define ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE MAKE_SQLSTATE('2','2', '0','1','0') #define ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE MAKE_SQLSTATE('2','2', '0','1','0')
#define ERRCODE_INVALID_LIMIT_VALUE MAKE_SQLSTATE('2','2', '0','2','0')
#define ERRCODE_INVALID_PARAMETER_VALUE MAKE_SQLSTATE('2','2', '0','2','3') #define ERRCODE_INVALID_PARAMETER_VALUE MAKE_SQLSTATE('2','2', '0','2','3')
#define ERRCODE_INVALID_REGULAR_EXPRESSION MAKE_SQLSTATE('2','2', '0','1','B') #define ERRCODE_INVALID_REGULAR_EXPRESSION MAKE_SQLSTATE('2','2', '0','1','B')
#define ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE MAKE_SQLSTATE('2', '2', '0', '1', 'W')
#define ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE MAKE_SQLSTATE('2', '2', '0', '1', 'X')
#define ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE MAKE_SQLSTATE('2','2', '0','0','9') #define ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE MAKE_SQLSTATE('2','2', '0','0','9')
#define ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2', '0','0','C') #define ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER MAKE_SQLSTATE('2','2', '0','0','C')
#define ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH MAKE_SQLSTATE('2','2', '0','0','G') #define ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH MAKE_SQLSTATE('2','2', '0','0','G')
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Copyright (c) 2003-2009, PostgreSQL Global Development Group * Copyright (c) 2003-2009, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/pl/plpgsql/src/plerrcodes.h,v 1.17 2009/01/01 17:24:04 momjian Exp $ * $PostgreSQL: pgsql/src/pl/plpgsql/src/plerrcodes.h,v 1.18 2009/03/04 10:55:00 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -176,15 +176,19 @@ ...@@ -176,15 +176,19 @@
}, },
{ {
"invalid_limit_value", ERRCODE_INVALID_LIMIT_VALUE "invalid_parameter_value", ERRCODE_INVALID_PARAMETER_VALUE
}, },
{ {
"invalid_parameter_value", ERRCODE_INVALID_PARAMETER_VALUE "invalid_regular_expression", ERRCODE_INVALID_REGULAR_EXPRESSION
}, },
{ {
"invalid_regular_expression", ERRCODE_INVALID_REGULAR_EXPRESSION "invalid_row_count_in_limit_clause", ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE
},
{
"invalid_row_count_in_result_offset_clause", ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE
}, },
{ {
......
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