X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6D7F0DA3A3 for ; Thu, 6 Oct 2005 07:40:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14658-03 for ; Thu, 6 Oct 2005 10:39:55 +0000 (GMT) Received: from ms004msg.fastwebnet.it (ms004msg.fastwebnet.it [213.140.2.58]) by svr1.postgresql.org (Postfix) with ESMTP id 7114FDA377 for ; Thu, 6 Oct 2005 07:39:54 -0300 (ADT) Received: from lyra (1.17.192.122) by ms004msg.fastwebnet.it (7.2.060.2) id 42F2241400BFCA62 for pgsql-sql@postgresql.org; Thu, 6 Oct 2005 12:39:56 +0200 Received: from localhost (lyra [127.0.0.1]) by lyra (Postfix) with ESMTP id 13277197368 for ; Thu, 6 Oct 2005 12:40:09 +0200 (CEST) Received: from lyra ([127.0.0.1]) by localhost (lyra [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 32561-05 for ; Thu, 6 Oct 2005 12:40:06 +0200 (CEST) Received: by lyra (Postfix, from userid 1003) id D96D3197367; Thu, 6 Oct 2005 12:40:06 +0200 (CEST) Subject: Noob question about types and lists From: xchris To: pgsql-sql@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 06 Oct 2005 12:40:06 +0200 Message-Id: <1128595206.27646.18.camel@lyra> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at lyra X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.697 required=5 tests=[AWL=-0.047, DNS_FROM_RFC_ABUSE=0.374, RCVD_ILLEGAL_IP=1.37] X-Spam-Level: * X-Archive-Number: 200510/49 X-Sequence-Number: 22902 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