Обсуждение: best way to check identical constraint between databases

Поиск
Список
Период
Сортировка

best way to check identical constraint between databases

От
Marc Cousin
Дата:
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