Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id CE8D09FB3AE for ; Tue, 31 Oct 2006 15:57:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 22837-04 for ; Tue, 31 Oct 2006 19:57:06 +0000 (UTC) X-Greylist: delayed 00:06:38.853148 by SQLgrey- Received: from hm32.locaweb.com.br (hm32-2.locaweb.com.br [200.234.205.174]) by postgresql.org (Postfix) with SMTP id AD0D59FB3AF for ; Tue, 31 Oct 2006 15:57:03 -0400 (AST) Received: (qmail 19497 invoked from network); 31 Oct 2006 19:50:21 -0000 Received: from unknown (10.1.10.101) by hm32.locaweb.com.br with QMQP; 31 Oct 2006 19:50:21 -0000 Received: from unknown (HELO cf) (jvfingercw@wiseup.com.br@201.21.164.21) by hm101.locaweb.com.br with SMTP; 31 Oct 2006 19:50:49 -0000 Message-ID: <001901c6fd25$cc2b60d0$f001a8c0@cf> From: "Jose" To: Subject: Composite Types Date: Tue, 31 Oct 2006 16:50:20 -0300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0016_01C6FD0C.A6990980" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/62 X-Sequence-Number: 26714 This is a multi-part message in MIME format. ------=_NextPart_000_0016_01C6FD0C.A6990980 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D and=20 CREATE TYPE telcontato AS (telefone1 varchar(15), telefone2 varchar(15), telefone3 varchar(15)); ALTER TYPE telcontato OWNER TO postgres; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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) )=20 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 ------=_NextPart_000_0016_01C6FD0C.A6990980 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello
I am using  postgres r8.1 and i = make 2 Composite Types
as:
CREATE TYPE regiao AS
   = (pais_nome=20 varchar(150),
    estado_nome=20 varchar(150),
    estado_sigla=20 varchar(4),
    cidade_nome varchar(150));
ALTER = TYPE=20 regiao OWNER TO = postgres;
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
and
CREATE TYPE telcontato = AS
  =20 (telefone1 varchar(15),
    telefone2=20 varchar(15),
    telefone3 varchar(15));
ALTER TYPE = telcontato OWNER TO = postgres;
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
and a table as
REATE TABLE unidades
(
  = unidade_pa int4=20 NOT NULL,
  unidade_tipo int4,
  unidade_nome = varchar(100) NOT=20 NULL,
  unidade_razao varchar(150),
  unidade_bandeira=20 varchar(1),
  unidade_endereco varchar(150),
  = unidade_bairro=20 varchar(80),
  unidade_regiao regiao,
  unidade_cep=20 varchar(10),
  unidade_cnpj varchar(110),
  = unidade_radio=20 varchar(15),
  unidade_contato telcontato,
  = unidade_abertura=20 date,
  unidade_contrato date,
  CONSTRAINT = unidades_pkey=20 PRIMARY KEY (unidade_pa)
)
WITHOUT OIDS;
ALTER TABLE unidades = OWNER TO=20 postgres;
I can insert without problems rows in = my table and=20 of corse I can retreave this information if I use select * from=20 .....
ok
My problem is , How I can make a query = to=20 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=20 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=20 Types ?
 
Thaks any help
J. V. Finger
 
 
 
------=_NextPart_000_0016_01C6FD0C.A6990980--