core: Fix syntax errors on postgres
export: Always compare offset-aware datetimes

Thanks Toni Hermoso Pulido for reporting the issue