diff options
author | Dave Arter <davea@mysociety.org> | 2020-05-26 13:34:34 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2020-05-27 10:28:44 +0100 |
commit | 7b7e00c16f6d31ff77b9f28e63aac3b608f2bfbb (patch) | |
tree | b0799178a05a0c6640ac0f24a1107e061042a6d5 | |
parent | c6e723a2fee40f7009de3f04de5870693e12889e (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
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rwxr-xr-x | bin/update-schema | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ba34d428c..e0afca449 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Unreleased - Bugfixes: - Fix issue with dashboard report CSV export. #3026 + - bin/update-schema PostgreSQL 12 compatibility. #3043 - Admin improvements: - Display user name/email for contributed as reports. #2990 - Interface for enabling anonymous reports for certain categories. #2989 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/; } |