Re: pg_restore casts check constraints differently

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joshua Ma <josh(at)benchling(dot)com>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>, Victor Pontis <victor(at)benchling(dot)com>
Subject: Re: pg_restore casts check constraints differently
Date: 2016-03-29 22:06:05
Message-ID: CAKFQuwYvZudN4QPbyC67ZbhpXM4Q1Q1Av+nj0vMPrZyD176J0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Mar 29, 2016 at 2:45 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Joshua Ma <josh(at)benchling(dot)com> writes:
> > This might not be a common case, but we're using pg_dump in a testing
> > environment to check migrations - 1) we initialize the db from HEAD,
> > pg_dump it, 2) we initialize the db from migration_base.sql, apply
> > migrations, pg_dump it, and 3) compare the two dumps to verify that our
> > migrations are correct wrt schema.
>
> > However, we're seeing pg_restore transforming our check constraints with
> > different casting.
>
> It's not really different. What you're seeing is pg_dump (or actually
> ruleutils.c) choosing to dump some implicit casts explicitly to ensure
> that the expression is parsed the same way next time. It might be
> overly conservative to do so, but we've found that erring in this
> direction tends to avoid breakage when the result is loaded into another
> server version; it's a bit like the intentional overparenthesization.
>

​Why don't we just use ruleutils.c to generate \d results so that what we
end up showing is canonical?

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Constable 2016-03-29 22:25:18 Re: debugging server connection issue
Previous Message Tom Lane 2016-03-29 21:45:52 Re: pg_restore casts check constraints differently

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2016-03-29 22:14:13 Re: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used
Previous Message Tom Lane 2016-03-29 21:52:05 Re: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used