Noob question about types and lists - Mailing list pgsql-sql

From xchris
Subject Noob question about types and lists
Date
Msg-id 1128595206.27646.18.camel@lyra
Whole thread Raw
Responses Re: Noob question about types and lists  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
Hi,
i'm really new to postgres and have some doubts.
Hope somebody could explain.

Let say i have a table of "clients" and every client has a small number
of addresses. (let say 3)
My approch is to create a type "address" like this (simplified)

CREATE TYPE address AS
(       street          VARCHAR(160),       city            INTEGER,       cap             INTEGER,       country
 INTEGER  (those are referring to other table)
 
);

and then composing table client

CREATE TABLE client
(       id              SERIAL PRIMARY KEY,       name            VARCHAR(80),       surname         VARCHAR(80),
address        address[3]....       UNIQUE (name,surname)
 
);


This doesn't work.
I cannot create a list of types.

I'm using a wrong syntax? or simply i cannot do this?

Please forgive me if this is explained somewhere in the doc or in faqs,I
didn't find it.

Thank You

Christian


pgsql-sql by date:

Previous
From: "Eugene E."
Date:
Subject: Re: catching errors in function
Next
From: Richard Huxton
Date:
Subject: Re: Noob question about types and lists