Patch applied.

---------------------------------------------------------------------------

Tom Lane wrote:
> Bruce Momjian <[EMAIL PROTECTED]> writes:
> > Tom Lane wrote:
> >> The exclamation point seems inappropriate.  Perhaps "zero-length input"
> >> would be better than "string" also.
> 
> > I copied the other test case:
> 
> >     if (s == (char *) NULL)
> >         elog(ERROR, "pg_atoi: NULL pointer!"); 
> 
> Well, the NULL-pointer test might equally well be coded as an Assert:
> it's to catch backend coding errors, not cases of incorrect user input.
> So the exclamation point there didn't bother me.
> 
> > I removed them both '!'.
> 
> If you like.  But the two conditions are not comparable.
> 
>                       regards, tom lane
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/utils/adt/numutils.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/utils/adt/numutils.c,v
retrieving revision 1.51
diff -c -c -r1.51 numutils.c
*** src/backend/utils/adt/numutils.c    16 Jul 2002 18:34:16 -0000      1.51
--- src/backend/utils/adt/numutils.c    27 Aug 2002 20:28:41 -0000
***************
*** 58,66 ****
         */
  
        if (s == (char *) NULL)
!               elog(ERROR, "pg_atoi: NULL pointer!");
        else if (*s == 0)
!               l = (long) 0;
        else
                l = strtol(s, &badp, 10);
  
--- 58,66 ----
         */
  
        if (s == (char *) NULL)
!               elog(ERROR, "pg_atoi: NULL pointer");
        else if (*s == 0)
!               elog(ERROR, "pg_atoi: zero-length string");
        else
                l = strtol(s, &badp, 10);
  
Index: src/test/regress/expected/arrays.out
===================================================================
RCS file: /cvsroot/pgsql-server/src/test/regress/expected/arrays.out,v
retrieving revision 1.9
diff -c -c -r1.9 arrays.out
*** src/test/regress/expected/arrays.out        29 Nov 2001 21:02:41 -0000      1.9
--- src/test/regress/expected/arrays.out        27 Aug 2002 20:28:45 -0000
***************
*** 15,21 ****
  -- '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}}}', '{}', '{}', '{}', '{}');
  UPDATE arrtest SET e[0] = '1.1';
  UPDATE arrtest SET e[1] = '2.2';
  INSERT INTO arrtest (f)
--- 15,21 ----
  -- '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}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}');
  UPDATE arrtest SET e[0] = '1.1';
  UPDATE arrtest SET e[1] = '2.2';
  INSERT INTO arrtest (f)
Index: src/test/regress/expected/copy2.out
===================================================================
RCS file: /cvsroot/pgsql-server/src/test/regress/expected/copy2.out,v
retrieving revision 1.6
diff -c -c -r1.6 copy2.out
*** src/test/regress/expected/copy2.out 22 Aug 2002 00:01:51 -0000      1.6
--- src/test/regress/expected/copy2.out 27 Aug 2002 20:28:45 -0000
***************
*** 34,40 ****
  ERROR:  Attribute "d" specified more than once
  -- missing data: should fail
  COPY x from stdin;
! ERROR:  copy: line 1, Missing data for column "b"
  lost synchronization with server, resetting connection
  COPY x from stdin;
  ERROR:  copy: line 1, Missing data for column "e"
--- 34,40 ----
  ERROR:  Attribute "d" specified more than once
  -- missing data: should fail
  COPY x from stdin;
! 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"
Index: src/test/regress/sql/arrays.sql
===================================================================
RCS file: /cvsroot/pgsql-server/src/test/regress/sql/arrays.sql,v
retrieving revision 1.8
diff -c -c -r1.8 arrays.sql
*** src/test/regress/sql/arrays.sql     21 May 2001 16:54:46 -0000      1.8
--- src/test/regress/sql/arrays.sql     27 Aug 2002 20:28:45 -0000
***************
*** 18,24 ****
  --
  
  INSERT INTO arrtest (a[5], b[2][1][2], c, d, f, g)
!    VALUES ('{1,2,3,4,5}', '{{{},{1,2}}}', '{}', '{}', '{}', '{}');
  
  UPDATE arrtest SET e[0] = '1.1';
  
--- 18,24 ----
  --
  
  INSERT INTO arrtest (a[5], b[2][1][2], c, d, f, g)
!    VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}');
  
  UPDATE arrtest SET e[0] = '1.1';
  

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to