Closed oree closed 8 years ago
The current ActiveRecordCheck fails on Postgres, because SELECT 1=1 returns true, not 1 as the check expects.
SELECT 1=1
true
1
On Postgres:
postgresql=> SELECT 1=1; ?column? ---------- t (1 row) postgresql=> SELECT 1; ?column? ---------- 1 (1 row)
On MySQL:
mysql> SELECT 1=1; +-----+ | 1=1 | +-----+ | 1 | +-----+ 1 row in set (0.00 sec) mysql> SELECT 1; +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec)
Hence the check at https://github.com/basecamp/easymon/blob/master/lib/easymon/checks/active_record_check.rb#L21 fails on Postgres.
Would you consider changing the check to just SELECT 1, which would work on MySQL, Postgres, SQLite, and probably quite a few others? Should I submit a pull request for the change?
SELECT 1
You are more than welcome to submit a pull request (including tests) and we'll get it merged in.
The current ActiveRecordCheck fails on Postgres, because
SELECT 1=1
returnstrue
, not1
as the check expects.On Postgres:
On MySQL:
Hence the check at https://github.com/basecamp/easymon/blob/master/lib/easymon/checks/active_record_check.rb#L21 fails on Postgres.
Would you consider changing the check to just
SELECT 1
, which would work on MySQL, Postgres, SQLite, and probably quite a few others?Should I submit a pull request for the change?