Re: ALTER composite type does not work, but ALTER TABLE which ROWTYPE is used as a type - works fine

Поиск
Список
Период
Сортировка
От Dmitry Koterov
Тема Re: ALTER composite type does not work, but ALTER TABLE which ROWTYPE is used as a type - works fine
Дата
Msg-id d7df81620812071249g348a4743l7fbb0e9818121fb6@mail.gmail.com
обсуждение исходный текст
Ответ на Re: ALTER composite type does not work, but ALTER TABLE which ROWTYPE is used as a type - works fine  ("Merlin Moncure" <mmoncure@gmail.com>)
Ответы Re: ALTER composite type does not work, but ALTER TABLE which ROWTYPE is used as a type - works fine  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
Could you please say, if ALTER TYPE ... ADD COLUMN is planned for a future PostgreSQL version?


On Fri, Dec 5, 2008 at 4:08 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
On Thu, Dec 4, 2008 at 9:53 AM, Dmitry Koterov <dmitry@koterov.ru> wrote:
> Hello.
>
> I can successfully ALTER a NON-EMPTY table (ct) which ROWTYPE is used as a
> column type for another table (dt):
>
> CREATE TABLE ct (id INTEGER);
> CREATE TABLE dt (id INTEGER, c ct);
>
> INSERT INTO dt VALUES(1, '(666)');
> SELECT * FROM dt;
> -- (1, '(666)')
>
> ALTER TABLE ct ADD COLUMN n INTEGER;
> SELECT * FROM dt;
> -- (1, '(666,)')
>
> You see, '(666,)' means that the new field is added successfully.
>
>
> But, if I declare ct as a COMPOSITE type (not a table), it is not permitted
> to ALTER this type (Postgres says that there are dependensies on ct).
> Why?

Because of this there is no reason to ever use 'create type'....always
use 'create table'.  'alter type' can't add/remove columns anyways.

merlin

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

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

Предыдущее
От: "David Rowley"
Дата:
Сообщение: Re: Windowing Function Patch Review -> Standard Conformance
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Assertion failure in new outer/semi/anti join code