Re: ALTER composite type does not work, but ALTER TABLE which ROWTYPE is used as a type - works fine
От | Alvaro Herrera |
---|---|
Тема | Re: ALTER composite type does not work, but ALTER TABLE which ROWTYPE is used as a type - works fine |
Дата | |
Msg-id | 20081210143953.GC5503@alvh.no-ip.org обсуждение исходный текст |
Ответ на | Re: ALTER composite type does not work, but ALTER TABLE which ROWTYPE is used as a type - works fine ("Merlin Moncure" <mmoncure@gmail.com>) |
Список | pgsql-hackers |
Merlin Moncure escribió: > On Wed, Dec 10, 2008 at 9:05 AM, Alvaro Herrera > <alvherre@commandprompt.com> wrote: > > I disagree that CREATE TABLE should be (or should have been) used to > > create types. Someday we might need to expand the work we do for that > > case in a different direction than tables, and we would be stuck. > > But, tables _are_ types, particularly in relational parlance. Well, yeah, they are on relational. But here on Postgres, "tables are types" is correct, but not the other way around. (And this is expressed by "tables are in pg_class, types are on pg_type"; and tables "have" an homonymous type.) The distinction is blurred by having composites in pg_class too, of course. (I don't know the reason that they are. Maybe they don't really need to. Maybe we could get away with having pg_attribute entries with no corresponding pg_class entry.) I'm not too sure about ALTER TYPE duplicating stuff. Perhaps they could both be implemented by the same code underneath. Up to now, I haven't seen much request for these features such as check constraints on composites; perhaps that's the reason we don't have them. > > In fact, types are not in pg_class at all. > > incorrect!! composite types are in pg_class (relkind='c'). That > actually knida confirms what I'm saying, composite types were added in > a confusing overlay over the 'create type' command, which is something > completely different. create type means two completely different > things depending on a minor grammar change...gah! :-) Maybe the problem is not that they are created with CREATE TYPE, but that they have a pg_class entry ;-) > I still stand by by statement...create table should have allowed you > to create a composite type as we do it with create type as today...and > (perhaps) storage (relfrozenxid etc.) could be added or removed with > alter table. Well, these days we could probably have implemented this as CREATE TABLE with a specific storage option. We didn't have that at the time. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support
В списке pgsql-hackers по дате отправления: