Search code examples
yugabytedb

Making ysql_dump in YugabyteDB compatible with PostgreSQL


[Question posted by a user on YugabyteDB Community Slack]

After this commit: [7813] [YSQL] YSQL dump should always include HASH/ASC/DESC modifier for indexes/primary-key.

This makes the ysql_dump unrestorable in PostgreSQL. Is there a workaround? I really need to restore a YugabyteDB dump to PostgreSQL instance.


Solution

  • A simple workaround is to make 2 dumps. The first one is just for the schema in text format.

    Try importing it in PostgreSQL, see the errors and you can easily fix the DDL queries manually by removing HASH or special keywords that YugabyteDB uses.

    Then take another dump, but this time just for the data which should be able to be imported in PostgreSQL.