Postgresql 8.3X supports Arrays of Composite Types?

Поиск
Список
Период
Сортировка
От Robson Fidalgo
Тема Postgresql 8.3X supports Arrays of Composite Types?
Дата
Msg-id 41534c40904191403m2eeabc27tc4bc6ce206c87464@mail.gmail.com
обсуждение исходный текст
Ответы Re: Postgresql 8.3X supports Arrays of Composite Types?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Postgresql 8.3X supports Arrays of Composite Types?  (David Fetter <david@fetter.org>)
Re: Postgresql 8.3X supports Arrays of Composite Types?  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general

Hello,
I am using postgresql 8.3X and I created a table (see example below) that has an attribute that is an Array of a Composite Type (ROW). However, I do not know how can I insert a record in this table.

Well, I've searched the mailing lists and have found little said about the OR features. In postgres 8.3X on-line documentation (http://www.postgresql.org/docs/8.3/static/arrays.html) I found "Arrays of any built-in or user-defined base type, enum type, or composite type can be created", however there is no example that explains how can I do an insert into an attribute that is an Array of Composite Type. Considering the example below, "persons have N phones" I create (with success) the Person table with an array of phones, but I have not success with Insert values. There is some one that can help me?

Thanks in advances,

Robson

Example:

CREATE table phone (
  cod varchar,
  num varchar);

CREATE TABLE person (
  name varchar,
  telephone phone[]);

Until here is everything ok, but I have not success with insert values, then I tried:

1)insert into person values ('Joe', '{("1","1111"),("2","2222") }');
2)insert into person values ('Joe', array[('1','1111'),('2','2222')]);
3)insert into person values ('Joe', array[row('1','1111'),row('2','2222')]);
4)insert into person values ('Joe', _phone[phone('1','1111'),phone('2','2222')]);**
** considering _phone = name of array type (automatically created by postgres) and phone = name of composite type (also automatically created by postgres)

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

Предыдущее
От: aravind chandu
Дата:
Сообщение: Problem with pgpool-II tool
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Postgresql 8.3X supports Arrays of Composite Types?