array bad behavior?

From: "Thalis A(dot) Kalfigopoulos" <thalis(at)cs(dot)pitt(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: array bad behavior?
Date: 2001-05-24 19:22:59
Message-ID: Pine.LNX.4.21.0105241511480.317-100000@aluminum.cs.pitt.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I create the following table:
create table lala (id int,people varchar(10)[][]);

I insert as follows:
insert into lala values(1000,'{{"1_1","1_2"},{"2_1","2_2"}}');

Works just fine:
id | people
------+----------------------------
1000 | {{"1_1","1_2"},{"2_1","2_2"}}

Then I insert:
insert into lala values(1002,'{{"1_1"},{"2_1","2_2"}}');

Which behaves well i.e. for the first row it fills in an empty string for the missing element (2D array has to be NxN):
id | people
------+----------------------------
1000 | {{"1_1","1_2"},{"2_1",""}}
1002 | {{"1_1",""},{"2_1","2_2"}}

Then I insert:
insert into lala values(1003,'{{"1_1","1_2"},{"2_1"}}');

Which doesn't work exactly as expected, i.e. it doesn't fill in the missing element of the second row with an empty string as it did earlier, but instead truncates the first row to match the size of the second:
id | people
------+-------------------------------
1000 | {{"1_1","1_2"},{"2_1","2_2"}}
1002 | {{"1_1",""},{"2_1","2_2"}}
1003 | {{"1_1"},{"2_1"}}

Is that normal?

thanks in advance,
thalis

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Bowlby 2001-05-24 19:33:10 Re: [HACKERS] HP Unix 11.00 Compiler error.
Previous Message Tom Lane 2001-05-24 19:17:53 Re: [HACKERS] HP Unix 11.00 Compiler error.