I'm transferring select tables from my server to my laptop to work on locally. Dumping the entire db is infeasible due to space constraints on my laptop. One of the columns of one table is a custom data type, and when restoring I get the following error:
pg_restore: [archiver (db)] could not execute query: ERROR: type "custom_data_type" does not exist
There are two ways I could solve this problem, but I'm having trouble finding instructions online to:
pg_dump
has the option:
-s --schema-only
Dump only the object definitions (schema), not data.
This option is the inverse of --data-only. It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data.
(Do not confuse this with the --schema option, which uses the word "schema" in a different meaning.)
Which, unless your source database has a ton of DDL, should be OK for you. If your source does have a ton of DDL, you can manually extract the type creation script from the pg_dump
output with your text editor of choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With