Rails 4에서 두 개의 매개 변수가있는이 쿼리는 SQLite의 개발 모드와 postgresql의 프로덕션 모드에서 실행되는 개발 시스템에서 잘 작동합니다. postgresql을 실행하는 프로덕션 서버로 이동할 때 운영자가 존재하지 않는다는 오류가 표시됩니다. 두 컴퓨터에서 postgresql 버전이 동일 할 때이 오류가 발생하는 이유는 무엇입니까?
@events = Event.where("published == ? AND event_date >= ?", true, DateTime.now.beginning_of_day).order('event_date ASC').limit(6)
오류:
E, [2014-06-14T13:26:24.470303 #28678] ERROR -- : PG::UndefinedFunction: ERROR: operator does not exist: boolean == unknown
LINE 1: ...ELECT "events".* FROM "events" WHERE (published == 't' AND...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT "events".* FROM "events" WHERE (published == 't' AND event_date >= '2014-06-14 04:00:00.000000') ORDER BY event_date ASC LIMIT 6
I, [2014-06-14T13:26:24.470786 #28678] INFO -- : Completed 500 Internal Server Error in 163ms
F, [2014-06-14T13:26:24.475470 #28678] FATAL -- :
PG :: UndefinedFunction : 오류 : 연산자가 없습니다. 부울 == 알 수 없음
equal(=) sign
PostgreSQL 문서에 명시된대로 하나만 사용해야합니다.
여기에 문서가 있습니다.
이것은 작동합니다
@events = Event.where("published = ? AND event_date >= ?", true, DateTime.now.beginning_of_day).order('event_date ASC').limit(6)
또한 two different databases
(귀하의 경우 SQLite
및 PostgresSQL
) development
및 production
.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다