how to add array of objects to a record

From: "dfx" <dfx(at)dfx(dot)it>
To: <pgsql-general(at)postgresql(dot)org>
Subject: how to add array of objects to a record
Date: 2008-02-03 09:38:14
Message-ID: 002c01c86648$849a1cb0$f400a8c0@SEMPRON
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi list,

Can I add an array of object to a record?

For example if I have a class (or type) phone_number:

create type phone_number as(
name char(20),
caption char(50),
ph_num char(25));

and I would like associate several (unknown number, a priori) phone numbers
to a record "persons"
can I create a table like this:

create table persons(
id integer,
first_name char(50),
family_name char(50),
phone_numbers phone_number[])

and how I have to write the insert and the select queries to put and get
the array of phone numbers?

thank you

Domenico

Responses

Browse pgsql-general by date

  From Date Subject
Next Message vladimir konrad 2008-02-03 11:10:02 Re: [OT] "advanced" database design (long)
Previous Message Jean-Paul Argudo 2008-02-03 08:49:44 Re: PostgreSQL Certification