Skip to content

Commit

Permalink
Fix update-schema constraint check on Postgres 12
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davea committed May 26, 2020
1 parent 62c9392 commit f3358d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Unreleased
- Bugfixes:
- Fix issue with dashboard report CSV export. #3026
- bin/update-scheme PostgreSQL 12 compatibility. #3043
- Admin improvements:
- Display user name/email for contributed as reports. #2990
- Interface for enabling anonymous reports for certain categories. #2989
Expand Down
2 changes: 1 addition & 1 deletion bin/update-schema
Original file line number Diff line number Diff line change
Expand Up @@ -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/;
}
Expand Down

0 comments on commit f3358d4

Please sign in to comment.