Re: Typed tables

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Typed tables
Дата
Msg-id b42b73150911051355p12747d17hb4c75476c97adfe1@mail.gmail.com
обсуждение исходный текст
Ответ на Typed tables  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Typed tables
Список pgsql-hackers
On Thu, Nov 5, 2009 at 12:24 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> I'm planning to work on typed tables support.  The idea is that you
> create a table out of a composite type (as opposed to the other way
> around, which is currently done automatically).
>
> CREATE TYPE persons_type AS (name text, bdate date);
>
> CREATE TABLE persons OF persons_type;
>
> Or the fancy version:
>
> CREATE TABLE persons OF persons_type ( PRIMARY KEY (name) );

I use composite types (via tables) all the time but I never use
'create type as'...because by doing so you lose the ability to alter
the type with 'alter table'.

Am I correct that I could use your idea to make this possible (albeit
quite ugly) by:

create type foo(a text, b text);
create table foo of foo;
alter table foo add column c text;
drop table foo;  -- does this drop the type as well??

merlin


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: AFTER triggers & RETURN
Следующее
От: Tom Lane
Дата:
Сообщение: Re: AFTER triggers & RETURN