From: | "Sean Mullen" <smullen(at)optusnet(dot)com(dot)au> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | array [] vs {} |
Date: | 2003-06-02 17:09:04 |
Message-ID: | 001b01c32929$abcb4810$0100a8c0@BM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I am attempting to use arrays in a db for the first time and am having
strife:
[] notation work only on non-empty initialized arrays. Is this
a feature/bug I should know about? For example:
create table test (
myname varchar(50),
myarray int[]
);
INSERT INTO test (myname) values ('bobo');
UPDATE test SET myarray[1] = 5;
SELECT * FROM TEST;
myname | myarray
--------+---------
bobo |
(1 row)
-- An empty array column is not what I'd expect
-- but curly brackets work
UPDATE test SET myarray = '{5}';
SELECT * FROM TEST;
myname | myarray
--------+---------
bobo | {5}
(1 row)
-- However If I revert to [] notation I can do as I please:
UPDATE test SET myarray[2] = 50;
SELECT * FROM TEST;
myname | myarray
--------+---------
bobo | {5,50}
(1 row)
- [] works as expected?
Any tips for getting myarray[1] to behave?
Sean
From | Date | Subject | |
---|---|---|---|
Next Message | javier garcia - CEBAS | 2003-06-02 17:28:23 | European datestyle |
Previous Message | Joe Conway | 2003-06-02 16:54:17 | Re: Accessing 2 different databases in the same query ? |