Thread: BUG #2790: constructor for int2vector seems to be buggy

BUG #2790: constructor for int2vector seems to be buggy

From
"Gurjeet Singh"
Date:
The following bug has been logged online:

Bug reference:      2790
Logged by:          Gurjeet Singh
Email address:      singh.gurjeet@gmail.com
PostgreSQL version: 8.2beta3
Operating system:   Windows
Description:        constructor for int2vector seems to be buggy
Details:

I couldn't find any documentation for the data type 'int2vector', so I
assume it is unsupported. And moreover, probably I am using an unsupported
syntax for populating it, so it may be not that high on priority.

But still filing, in case it uncovers something else.

    In the first INSERT statement, the array elements are separated by a
comma and a space; in the second one, the ones that are separated by just a
comma, do not get inserted!

    I could not reproduce it in standard inetegr arrays.

Session o/p:

postgres=# select version();
                                                version

----------------------------------------------------------------------------
----
------------------------
 PostgreSQL 8.2beta3 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.2.3
(mi
ngw special 20030504-1)
(1 row)

postgres=# create table t ( a int2vector );
CREATE TABLE
postgres=# insert into t values ( '1, 2, 3' );
INSERT 0 1
postgres=# insert into t values ( '1,2,3, 4' );
INSERT 0 1
postgres=# select * from t;
   a
-------
 1 2 3
 1 4
(2 rows)

postgres=#

Best regards,

--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | yahoo }.com

Re: BUG #2790: constructor for int2vector seems to be buggy

From
Tom Lane
Date:
"Gurjeet Singh" <singh.gurjeet@gmail.com> writes:
>     In the first INSERT statement, the array elements are separated by a
> comma and a space; in the second one, the ones that are separated by just a
> comma, do not get inserted!

The syntax is space-separated integers; where did you get the idea to
use commas?

            regards, tom lane

Re: BUG #2790: constructor for int2vector seems to be buggy

From
"Gurjeet Singh"
Date:
On 11/28/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> The syntax is space-separated integers; where did you get the idea to
> use commas?


I donno... I just tried and it worked. But silently ignoring invalid
input...!!???

Potential bug's symptoms:
<quote from=http://www.postgresql.org/docs/current/static/bug-reporting.html
>
A program accepts invalid input without a notice or error message. But keep
in mind that your idea of invalid input might be our idea of an extension or
compatibility with traditional practice.
</quote>

Or is it a 'extension or compatibility with traditional practice'?

BTW, is int2vector really documented? I also found that abstime() works, but
couldn't find any documentation for it! (except for \df abstime)

Regards,

--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | yahoo }.com