[PATCH] bugfix for int2vectorin

From: Caleb Welton <cwelton(at)greenplum(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] bugfix for int2vectorin
Date: 2009-12-02 02:36:05
Message-ID: C73B1297.3D2D%cwelton@greenplum.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I believe the int2vectorin function should handle invalid input more cleanly.

Current behavior:

-- Correct input format:
SELECT '1 2 3'::int2vector;
int2vector
------------
1 2 3
(1 row)

-- Three variations on incorrect input format
SELECT '1not 2really_an 3int2vector'::int2vector;
int2vector
------------
1 2 3
(1 row)

SELECT '1,2,3'::int2vector;
int2vector
------------
1
(1 row)

SELECT '1, 2,3'::int2vector;
int2vector
------------
1 2
(1 row)

-- What other types do:
SELECT '1,2'::oid;
ERROR: invalid input syntax for type oid: "1,2"

Behavior after attached patch:

-- Correct input format:
SELECT '1 2 3'::int2vector;
int2vector
------------
1 2 3
(1 row)

-- Three variations on incorrect input format
SELECT '1not 2really_an 3int2vector'::int2vector;
ERROR: invalid input for int2vector: "1not 2really_an 3int2vector"

SELECT '1,2,3'::int2vector;
ERROR: invalid input for int2vector: "1,2,3"

SELECT '1, 2,3'::int2vector;
ERROR: invalid input for int2vector: "1, 2,3"

-- What other types do:
SELECT '1,2'::oid;
ERROR: invalid input syntax for type oid: "1,2"

Regards,
Caleb

Attachment Content-Type Size
int2vector.patch application/octet-stream 1.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Williamson 2009-12-02 02:46:23 Re: SE-PgSQL patch review
Previous Message Bruce Momjian 2009-12-02 02:31:20 Re: Page-level version upgrade (was: Block-level CRC checks)