Composite Types

From: "Jose" <jvfingercw(at)wiseup(dot)com(dot)br>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Composite Types
Date: 2006-10-31 19:50:20
Message-ID: 001901c6fd25$cc2b60d0$f001a8c0@cf
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2006-10-31 20:08:24 Re: Table Relationships
Previous Message Ezequias Rodrigues da Rocha 2006-10-31 19:35:17 Round Numeric Type