From 73b94657b0013a539a45287fc3ea6d6ec2511f5c Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 27 Aug 2002 20:29:11 +0000 Subject: [PATCH] Throw error on pg_atoi(''), regression adjustments. --- src/backend/utils/adt/numutils.c | 6 +++--- src/test/regress/expected/arrays.out | 2 +- src/test/regress/expected/copy2.out | 2 +- src/test/regress/sql/arrays.sql | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c index 3a9c03db7a..8adf3200dc 100644 --- a/src/backend/utils/adt/numutils.c +++ b/src/backend/utils/adt/numutils.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.51 2002/07/16 18:34:16 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.52 2002/08/27 20:29:10 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -58,9 +58,9 @@ pg_atoi(char *s, int size, int c) */ if (s == (char *) NULL) - elog(ERROR, "pg_atoi: NULL pointer!"); + elog(ERROR, "pg_atoi: NULL pointer"); else if (*s == 0) - l = (long) 0; + elog(ERROR, "pg_atoi: zero-length string"); else l = strtol(s, &badp, 10); diff --git a/src/test/regress/expected/arrays.out b/src/test/regress/expected/arrays.out index f729fe1ed4..11e126a457 100644 --- a/src/test/regress/expected/arrays.out +++ b/src/test/regress/expected/arrays.out @@ -15,7 +15,7 @@ CREATE TABLE arrtest ( -- 'e' is also a large object. -- INSERT INTO arrtest (a[5], b[2][1][2], c, d, f, g) - VALUES ('{1,2,3,4,5}', '{{{},{1,2}}}', '{}', '{}', '{}', '{}'); + VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}'); UPDATE arrtest SET e[0] = '1.1'; UPDATE arrtest SET e[1] = '2.2'; INSERT INTO arrtest (f) diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out index fa421e40ba..a024131310 100644 --- a/src/test/regress/expected/copy2.out +++ b/src/test/regress/expected/copy2.out @@ -34,7 +34,7 @@ COPY x (a, b, c, d, e, d, c) from stdin; ERROR: Attribute "d" specified more than once -- missing data: should fail COPY x from stdin; -ERROR: copy: line 1, Missing data for column "b" +ERROR: copy: line 1, pg_atoi: zero-length string lost synchronization with server, resetting connection COPY x from stdin; ERROR: copy: line 1, Missing data for column "e" diff --git a/src/test/regress/sql/arrays.sql b/src/test/regress/sql/arrays.sql index a3300eae12..2c4561456f 100644 --- a/src/test/regress/sql/arrays.sql +++ b/src/test/regress/sql/arrays.sql @@ -18,7 +18,7 @@ CREATE TABLE arrtest ( -- INSERT INTO arrtest (a[5], b[2][1][2], c, d, f, g) - VALUES ('{1,2,3,4,5}', '{{{},{1,2}}}', '{}', '{}', '{}', '{}'); + VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}'); UPDATE arrtest SET e[0] = '1.1';