Unable to create table of view row type
Started by Isaac Morlandalmost 3 years ago1 messages
I thought I should be able to do this:
=> create view testv as values (1, 'a'), (2, 'b'), (3, 'c');
CREATE VIEW
=> create table testt of testv;
ERROR: type testv is not a composite type
But as you can see I can’t. pg_type seems to think the type is composite:
ijmorlan=> select typtype from pg_type where typname = 'testv';
typtype
─────────
c
(1 row)
I’m guessing there are good reasons this isn’t supported, so I’m thinking
to provide a documentation patch for CREATE TABLE and ALTER TABLE to
specify that the type given for OF type_name must be a
non-relation-row-type composite type.
Am I missing something?