Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D72C69FA372 for ; Mon, 6 Nov 2006 15:34:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 26241-05 for ; Mon, 6 Nov 2006 15:34:15 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by postgresql.org (Postfix) with ESMTP id 5B85F9FA333 for ; Mon, 6 Nov 2006 15:34:15 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id c2so829218nfe for ; Mon, 06 Nov 2006 11:34:13 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Wg82g15OOaItaBOhfbwp+/7L6m/DBBfna1U8+bn6YXoFcQO4gIFjAjrlUJjc35/4bLPUtFaO70i0xufcFMl1YvtN/NUN/3H5r/P+6iNl+Ek2KdiMRQTfdv2zTr1DFPfGqDLBKVGo6PpUDAcXrweIfTdEfq0AXZSIe4Va8yK9MVY= Received: by 10.82.105.13 with SMTP id d13mr1375252buc.1162841653085; Mon, 06 Nov 2006 11:34:13 -0800 (PST) Received: by 10.82.161.3 with HTTP; Mon, 6 Nov 2006 11:34:12 -0800 (PST) Message-ID: <1f30b80c0611061134m769a4871rbb1523360fff00aa@mail.gmail.com> Date: Tue, 7 Nov 2006 00:34:12 +0500 From: imad To: Jose Subject: Re: Composite Types Cc: pgsql-sql@postgresql.org In-Reply-To: <001901c6fd25$cc2b60d0$f001a8c0@cf> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <001901c6fd25$cc2b60d0$f001a8c0@cf> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/81 X-Sequence-Number: 26733 This is *not* a good practice to handle elements of a composite data type seperately because they all build it up together and without one of it, the data type is meaningless. Secondly, If you are going to base our application on this principle, you better rethink your design. --Imad www.EnterpriseDB.com On 11/1/06, Jose wrote: > > > Hello > I am using postgres r8.1 and i make 2 Composite Types > as: > CREATE TYPE regiao AS > (pais_nome varchar(150), > estado_nome varchar(150), > estado_sigla varchar(4), > cidade_nome varchar(150)); > ALTER TYPE regiao OWNER TO postgres; > ================== > and > CREATE TYPE telcontato AS > (telefone1 varchar(15), > telefone2 varchar(15), > telefone3 varchar(15)); > ALTER TYPE telcontato OWNER TO postgres; > =========== > and a table as > REATE TABLE unidades > ( > unidade_pa int4 NOT NULL, > unidade_tipo int4, > unidade_nome varchar(100) NOT NULL, > unidade_razao varchar(150), > unidade_bandeira varchar(1), > unidade_endereco varchar(150), > unidade_bairro varchar(80), > unidade_regiao regiao, > unidade_cep varchar(10), > unidade_cnpj varchar(110), > unidade_radio varchar(15), > unidade_contato telcontato, > unidade_abertura date, > unidade_contrato date, > CONSTRAINT unidades_pkey PRIMARY KEY (unidade_pa) > ) > WITHOUT OIDS; > ALTER TABLE unidades OWNER TO postgres; > > I can insert without problems rows in my table and of corse I can retreave > this information if I use select * from ..... > ok > My problem is , How I can make a query to retreave the cidade_nome from > table unidades > If I use for example > select unidade_regiao.estado_sigla from unidades > I recive this message: > > ERROR: missing FROM-clause entry for table "unidade_regiao" > > If I try use > select unidade_regiao.(estado_sigla) from unidades > > I recive this message > > ERROR: syntax error at or near "(" at character 23 > > > So I ask How I can retrive a specific information if I use a Composite Types > ? > > Thaks any help > J. V. Finger > > >