Skip to content

Commit

Permalink
Warn and do not load sequel_pg if pg >1.2 is used
Browse files Browse the repository at this point in the history
pg 1.2.0 changed the internals in a way that breaks encoding handling
in sequel_pg.  This will be fixed in a future version of pg and
sequel_pg, but for now it is best to avoid the error and let people
know about the problem.
  • Loading branch information
jeremyevans committed Jan 2, 2020
1 parent 7641340 commit 217f544
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
=== master

* Warn and do not load sequel_pg if pg >1.2 is used (jeremyevans)

* Avoid verbose warnings on Ruby 2.7 due to tainting (jeremyevans)

=== 1.12.2 (2019-06-06)
Expand Down
5 changes: 5 additions & 0 deletions ext/sequel_pg/sequel_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,11 @@ void Init_sequel_pg(void) {
return;
}
}

if (RTEST(rb_eval_string("defined?(PG::VERSION) && PG::VERSION.to_f >= 1.2"))) {
rb_warn("sequel_pg not loaded as it is not compatible with the ruby-pg version in use; uninstall sequel_pg or downgrade pg to 1.1.4");
return;
}

rb_const_set(spg_Postgres, rb_intern("SEQUEL_PG_VERSION_INTEGER"), INT2FIX(SEQUEL_PG_VERSION_INTEGER));

Expand Down

0 comments on commit 217f544

Please sign in to comment.