0

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??

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

2 Comments

=) thxs a lot, i had to change the typenamespace in the query and remove the last "AND" statement. Now i'll have to find out how to export my Types into a new DB
well, finally i found the CREATE TYPE statement in the dump. In the phppgadmin i used the export tool =) thanks again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.