From: Jose <jvfingercw@wiseup.com.br>
To: pgsql-sql@postgresql.org
Subject: Composite Types
Date: Tue, 31 Oct 2006 16:50:20 -0300
Message-ID: <001901c6fd25$cc2b60d0$f001a8c0@cf> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jvfingercw@wiseup.com.br
Subject: Re: Composite Types
In-Reply-To: <001901c6fd25$cc2b60d0$f001a8c0@cf>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox