Skip to content

Commit 73b9465

Browse files
committed
Throw error on pg_atoi(''), regression adjustments.
1 parent 7292131 commit 73b9465

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/backend/utils/adt/numutils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.51 2002/07/16 18:34:16 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.52 2002/08/27 20:29:10 momjian Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -58,9 +58,9 @@ pg_atoi(char *s, int size, int c)
5858
*/
5959

6060
if (s == (char *) NULL)
61-
elog(ERROR, "pg_atoi: NULL pointer!");
61+
elog(ERROR, "pg_atoi: NULL pointer");
6262
else if (*s == 0)
63-
l = (long) 0;
63+
elog(ERROR, "pg_atoi: zero-length string");
6464
else
6565
l = strtol(s, &badp, 10);
6666

src/test/regress/expected/arrays.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CREATE TABLE arrtest (
1515
-- 'e' is also a large object.
1616
--
1717
INSERT INTO arrtest (a[5], b[2][1][2], c, d, f, g)
18-
VALUES ('{1,2,3,4,5}', '{{{},{1,2}}}', '{}', '{}', '{}', '{}');
18+
VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}');
1919
UPDATE arrtest SET e[0] = '1.1';
2020
UPDATE arrtest SET e[1] = '2.2';
2121
INSERT INTO arrtest (f)

src/test/regress/expected/copy2.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ COPY x (a, b, c, d, e, d, c) from stdin;
3434
ERROR: Attribute "d" specified more than once
3535
-- missing data: should fail
3636
COPY x from stdin;
37-
ERROR: copy: line 1, Missing data for column "b"
37+
ERROR: copy: line 1, pg_atoi: zero-length string
3838
lost synchronization with server, resetting connection
3939
COPY x from stdin;
4040
ERROR: copy: line 1, Missing data for column "e"

src/test/regress/sql/arrays.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CREATE TABLE arrtest (
1818
--
1919

2020
INSERT INTO arrtest (a[5], b[2][1][2], c, d, f, g)
21-
VALUES ('{1,2,3,4,5}', '{{{},{1,2}}}', '{}', '{}', '{}', '{}');
21+
VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}');
2222

2323
UPDATE arrtest SET e[0] = '1.1';
2424

0 commit comments

Comments
 (0)