When restoring a PostgreSQL database from a dump, the process is to simply feed PostgreSQL the dump file, whose SQL statements it executes.
CockroachDB seems to take a different approach in order to restore the database more efficiently. Unfortunately, it lacks support for the types of things that often occur in a PostgreSQL dump, such as sequences and computed indexes. Fortunately, these things can usually be removed from the database dump before importing, then executed as DDL after importing.
Also, it's not easy for a new CockroachDB user to follow the import process as documented, so I wanted to make it easy.
- Move all DDL statements related to
SEQUENCE
s,INDEX
es andVIEW
s into a separate SQL file. You'll need this later. - Ensure
client_min_messages
is set todebug5
in the PostgreSQL dump file. - Add your billing address and credit card details to CockroachDB if you haven't already. (Cockroach will prevent imports from external sources until you do.)
- Start a local HTTP server so your