core: Fix syntax errors on postgres