aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2020-05-26 13:34:34 +0100
committerDave Arter <davea@mysociety.org>2020-05-27 10:28:44 +0100
commit7b7e00c16f6d31ff77b9f28e63aac3b608f2bfbb (patch)
treeb0799178a05a0c6640ac0f24a1107e061042a6d5 /bin
parentc6e723a2fee40f7009de3f04de5870693e12889e (diff)
Fix update-schema constraint check on Postgres 12
pg_constraint.consrc has been removed in Postgres 12, and this is the recommended replacement. See https://www.postgresql.org/docs/12/release-12.html
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update-schema2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/update-schema b/bin/update-schema
index 8f31085c9..44e299b91 100755
--- a/bin/update-schema
+++ b/bin/update-schema
@@ -319,7 +319,7 @@ sub constraint_exists {
# Returns true if a check constraint contains a certain string
sub constraint_contains {
my ( $constraint, $check ) = @_;
- my ($consrc) = $db->dbh->selectrow_array('select consrc from pg_constraint where conname = ?', {}, $constraint);
+ my ($consrc) = $db->dbh->selectrow_array('select pg_get_expr(conbin, conrelid) from pg_constraint where conname = ?', {}, $constraint);
return unless $consrc;
return $consrc =~ /$check/;
}