Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • I am wondering, AFAIK there are no -X and -d options for pg_dump. pg_dump produces a dump that is restorable in an empty DB. Commented Sep 3, 2014 at 15:12
  • 1
    @dezso right, these were typos, I've updated the question. The dump sadly, is not restorable in an empty DB due to the reasons I am citing. Commented Sep 3, 2014 at 15:24
  • @ErwinBrandstetter I can reproduce the same problem on 9.6, see bugs.debian.org/cgi-bin/bugreport.cgi?bug=859033 for another example (more real-world, slightly larger, MWE) Commented Mar 31, 2017 at 14:07
  • @mirabilos: Well, that's not going to go away because CHECK constraints are not meant to reference other tables. NOT VALID as outlined below is a possible fix. Commented Mar 31, 2017 at 14:39
  • 2
    @mirabilos: I'd say: if you use a function that references other tables in a CHECK constraint, then all guarantees are voided, because that's not officially supported, just tolerated. But declaring the CHECK constraint NOT VALID made it work for me in every respect. There may be corner cases I never touched ... Commented Mar 31, 2017 at 16:03