Noob question about types and lists

Поиск
Список
Период
Сортировка
От xchris
Тема Noob question about types and lists
Дата
Msg-id 1128595206.27646.18.camel@lyra
обсуждение исходный текст
Ответы Re: Noob question about types and lists  (Richard Huxton <dev@archonet.com>)
Список 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 по дате отправления:

Предыдущее
От: "Eugene E."
Дата:
Сообщение: Re: catching errors in function
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Noob question about types and lists