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
|
- [SQL] Composite Types Jose
- Re: [SQL] Composite Types Tom Lane
- Re: [SQL] Composite Types imad