array bad behavior?

Поиск
Список
Период
Сортировка
От Thalis A. Kalfigopoulos
Тема array bad behavior?
Дата
Msg-id Pine.LNX.4.21.0105241511480.317-100000@aluminum.cs.pitt.edu
обсуждение исходный текст
Ответы Re: array bad behavior?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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
stringas 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Linh Luong
Дата:
Сообщение: Column name
Следующее
От: "Steven D. Arnold"
Дата:
Сообщение: strange stored procedure problem