Consider I have a user-defined type as follows:
CREATE TYPE mytype AS
(myvar character(1),
myvar2 bit(10));
Can I use any of Postgres’s information tables in order to get the attribute information for this type:
I.e. given “mytype”, the information I want is:
myvar : character(1)myvar2 : bit(10)
Yes, the
pg_typetable will have thetyprelidcolumn populated. This is an OID key for thepg_classtable, which then is used inpg_attributetables, just as with tables, views, indices etc. So sth like: