best way to check identical constraint between databases

From: Marc Cousin <cousinmarc(at)gmail(dot)com>
To: PostgreSQL-Dev <pgsql-hackers(at)postgresql(dot)org>
Subject: best way to check identical constraint between databases
Date: 2018-02-06 07:48:51
Message-ID: ce9ad989-d7ab-d922-671f-df699662ee12@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I'm trying to extend pg_tap/pg_tapgen in order to be able to check that
two databases have the exact same constraints (for all available types
of constraints).

I am wondering if there is a better way to check that two constraints
are equal than using pg_get_constraintdef, which is full text and may
change formatting between releases.

Using the pg_constraints columns could have the same problem anyway. For
check constraints, for instance, consrc could change formatting (even if
that's unlikely), and anyway parsing consrc would add much complexity to
pg_tap… typeids could be different so they would have to be resolved in
both databases.

So the question is, is there a better way of checking that a constraint
in a database is the same in another one than using pg_get_constraintdef
? (and printing a warning in the doc that it is only guaranteed to work
with the same PG release).

Regards

Marc

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2018-02-06 07:56:53 Re: [HACKERS] [PATCH] Vacuum: Update FSM more frequently
Previous Message Kyotaro HORIGUCHI 2018-02-06 07:35:42 Re: [HACKERS] Vacuum: allow usage of more than 1GB of work mem