Re: [QUESTIONS] using composite types

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [QUESTIONS] using composite types
Дата
Msg-id 350952B2.ACEED945@alumni.caltech.edu
обсуждение исходный текст
Ответы Re: [HACKERS] Re: [QUESTIONS] using composite types  (Bruce Momjian <maillist@candle.pha.pa.us>)
Re: [QUESTIONS] using composite types  (Peter T Mount <postgresdev@maidast.demon.co.uk>)
Список pgsql-hackers
> How can I use composite types?
> If I create two tables like this:
>         create table A ( a int, b int);
>         create table D ( a A, b int);
> I would expect to be able to
>         insert into D (a.a, a.b, b) values (1,2,3);
> and
>         select a.a, a.b, b from D;
> That doesn't work, at least not with postgresql 6.3.  Is that the way
> it's supposed to work?  What is the proper way to do it?

I'm not sure if this is supported. The old tutorial does not have an
example exactly like this (at least that I could find), but it seems
like it _should_ work, and the backend accepts the syntax.

What you want to do can probably be accomplished with inheritance, but
that only seems to work if you have unique names for more of your
fields:

  create table A ( a int, b int);
  create table D ( c int) inherits (A);

But, if you try

  create table D ( b int) inherits (A);

then the new column in D gets lost without warning!

                           - Tom

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

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] Keyword
Следующее
От: "A. R. Van Hook"
Дата:
Сообщение: group control