core: Fix syntax errors on postgres

Tracked down broken error pages on postgresql to this. Was really annoying for debugging.