Generic detection for `engine_is_pg`

Fixes #345  (again :-P )

To be honest, I actually wonder why the previous detection ever worked for me...