使用此查询:
users = User.where('confirmed_at is NULL AND confirmation_sent_at <= DATE_SUB(NOW(), INTERVAL ? days)', 1)
在 mysql 中一切正常,但在 Postgresql 中失败:
PG::SyntaxError: ERROR: syntax error at or near "1" LINE 1: ...AND confirmation_sent_at <= DATE_SUB(NOW(), INTERVAL 1 day)) ^ : SELECT "users".* FROM "users" WHERE (confirmed_at is NULL AND confirmation_sent_at <= DATE_SUB(NOW(), INTERVAL 1 day))
我试图理解但错过了这里的上下文。为什么整数 1 在此查询中无效?