Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit12f87b2

Browse files
committed
Add new SQL:2008 error codes for invalid LIMIT and OFFSET values. Remove
unused nonstandard error code that was perhaps intended for this but neverused.
1 parent9add9f9 commit12f87b2

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

‎doc/src/sgml/errcodes.sgml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/errcodes.sgml,v 1.26 2008/12/28 18:53:53 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/errcodes.sgml,v 1.27 2009/03/04 10:55:00 petere Exp $ -->
22

33
<appendix id="errcodes-appendix">
44
<title><productname>PostgreSQL</productname> Error Codes</title>
@@ -444,12 +444,6 @@
444444
<entry>invalid_indicator_parameter_value</entry>
445445
</row>
446446

447-
<row>
448-
<entry><literal>22020</literal></entry>
449-
<entry>INVALID LIMIT VALUE</entry>
450-
<entry>invalid_limit_value</entry>
451-
</row>
452-
453447
<row>
454448
<entry><literal>22023</literal></entry>
455449
<entry>INVALID PARAMETER VALUE</entry>
@@ -462,6 +456,18 @@
462456
<entry>invalid_regular_expression</entry>
463457
</row>
464458

459+
<row>
460+
<entry><literal>2201W</literal></entry>
461+
<entry>INVALID ROW COUNT IN LIMIT CLAUSE</entry>
462+
<entry>invalid_row_count_in_limit_clause</entry>
463+
</row>
464+
465+
<row>
466+
<entry><literal>2201X</literal></entry>
467+
<entry>INVALID ROW COUNT IN RESULT OFFSET CLAUSE</entry>
468+
<entry>invalid_row_count_in_result_offset_clause</entry>
469+
</row>
470+
465471
<row>
466472
<entry><literal>22009</literal></entry>
467473
<entry>INVALID TIME ZONE DISPLACEMENT VALUE</entry>

‎src/backend/executor/nodeLimit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.35 2009/01/01 17:23:41 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.36 2009/03/04 10:55:00 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -247,7 +247,7 @@ recompute_limits(LimitState *node)
247247
node->offset=DatumGetInt64(val);
248248
if (node->offset<0)
249249
ereport(ERROR,
250-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
250+
(errcode(ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE),
251251
errmsg("OFFSET must not be negative")));
252252
}
253253
}
@@ -274,7 +274,7 @@ recompute_limits(LimitState *node)
274274
node->count=DatumGetInt64(val);
275275
if (node->count<0)
276276
ereport(ERROR,
277-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
277+
(errcode(ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE),
278278
errmsg("LIMIT must not be negative")));
279279
node->noCount= false;
280280
}

‎src/include/utils/errcodes.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
1313
*
14-
* $PostgreSQL: pgsql/src/include/utils/errcodes.h,v 1.28 2009/01/01 17:24:02 momjian Exp $
14+
* $PostgreSQL: pgsql/src/include/utils/errcodes.h,v 1.29 2009/03/04 10:55:00 petere Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -133,9 +133,10 @@
133133
#defineERRCODE_INVALID_ESCAPE_SEQUENCEMAKE_SQLSTATE('2','2', '0','2','5')
134134
#defineERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTERMAKE_SQLSTATE('2','2', 'P','0','6')
135135
#defineERRCODE_INVALID_INDICATOR_PARAMETER_VALUEMAKE_SQLSTATE('2','2', '0','1','0')
136-
#defineERRCODE_INVALID_LIMIT_VALUEMAKE_SQLSTATE('2','2', '0','2','0')
137136
#defineERRCODE_INVALID_PARAMETER_VALUEMAKE_SQLSTATE('2','2', '0','2','3')
138137
#defineERRCODE_INVALID_REGULAR_EXPRESSIONMAKE_SQLSTATE('2','2', '0','1','B')
138+
#defineERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSEMAKE_SQLSTATE('2', '2', '0', '1', 'W')
139+
#defineERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSEMAKE_SQLSTATE('2', '2', '0', '1', 'X')
139140
#defineERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUEMAKE_SQLSTATE('2','2', '0','0','9')
140141
#defineERRCODE_INVALID_USE_OF_ESCAPE_CHARACTERMAKE_SQLSTATE('2','2', '0','0','C')
141142
#defineERRCODE_MOST_SPECIFIC_TYPE_MISMATCH MAKE_SQLSTATE('2','2', '0','0','G')

‎src/pl/plpgsql/src/plerrcodes.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
1111
*
12-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/plerrcodes.h,v 1.17 2009/01/01 17:24:04 momjian Exp $
12+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/plerrcodes.h,v 1.18 2009/03/04 10:55:00 petere Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -176,15 +176,19 @@
176176
},
177177

178178
{
179-
"invalid_limit_value",ERRCODE_INVALID_LIMIT_VALUE
179+
"invalid_parameter_value",ERRCODE_INVALID_PARAMETER_VALUE
180180
},
181181

182182
{
183-
"invalid_parameter_value",ERRCODE_INVALID_PARAMETER_VALUE
183+
"invalid_regular_expression",ERRCODE_INVALID_REGULAR_EXPRESSION
184184
},
185185

186186
{
187-
"invalid_regular_expression",ERRCODE_INVALID_REGULAR_EXPRESSION
187+
"invalid_row_count_in_limit_clause",ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE
188+
},
189+
190+
{
191+
"invalid_row_count_in_result_offset_clause",ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE
188192
},
189193

190194
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp