Re: Composite Types

Поиск
Список
Период
Сортировка
От imad
Тема Re: Composite Types
Дата
Msg-id 1f30b80c0611061134m769a4871rbb1523360fff00aa@mail.gmail.com
обсуждение исходный текст
Ответ на Composite Types  ("Jose" <jvfingercw@wiseup.com.br>)
Список pgsql-sql
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 <jvfingercw@wiseup.com.br> 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
>
>
>


В списке pgsql-sql по дате отправления:

Предыдущее
От: Jorge Godoy
Дата:
Сообщение: Re: Distribution of results
Следующее
От: imad
Дата:
Сообщение: Re: Distribution of results