HI, this might sound like a silly question but.. i've created several "types" in a database using the CREATE TYPE command, now i'd like to use the same types in a different database in a different server and开发者_运维知识库 i didn't save my CREATE TYPE statements. Is there a way to export the types?? or even display the list of types with their fields and fieldtypes??
This is what pgAdmin3 uses:
SELECT t.oid ,
t.* ,
format_type(t.oid, NULL) AS ALIAS ,
pg_get_userbyid(t.typowner) AS typeowner,
e.typname AS element ,
description ,
ct.oid AS taboid
FROM pg_type T
LEFT OUTER JOIN pg_type E ON e.oid =t.typelem
LEFT OUTER JOIN pg_class ct ON ct.oid =t.typrelid AND ct.relkind <> 'c'
LEFT OUTER JOIN pg_description des ON des.objoid=t.oid
WHERE t.typtype != 'd'
AND t.typname NOT LIKE E'\\_%'
AND t.typnamespace = 3278632::oid
AND ct.oid IS NULL
ORDER BY t.typname
精彩评论