rsim / oracle-enhanced

Oracle enhaced adapter for ActiveRecord
MIT License
549 stars 311 forks source link

TimeWithZone not getting quoted in 5.2.6 #1945

Closed no-trick-pony closed 4 years ago

no-trick-pony commented 5 years ago

We are currently migrating from Rails 4.2 to Rails 5.2 and ran into issues with some queries that compare dates and times. We use different databases for Rails 4.2 and Rails 5.2 with the date fields in the Rails 5.2 database already converted as the update guide suggests. The following code succeeds in Rails 4.2 with oracle_enhanced-adapter 1.6.9 but fails in Rails 5.2 with oracle_enhanced-adapter 5.2.6:

Some::Model.where("trunc(updated_at) >= :some_date", some_date: Time.current)

On further inspection, some_date gets quoted with TO_TIMESTAMP in Rails 4 and adapter version 1.6.9 but not in Rails 5.2 with adapter version 5.2.6:

With Rails 4.2.11.1 and adapter version 1.6.9 the where clause gets converted to:

(trunc(updated_at) >= TO_TIMESTAMP('2019-10-21 19:25:10:984053','YYYY-MM-DD HH24:MI:SS:FF6'))

With Rails 5.2 and 5.2.6:

(trunc(updated_at) >= '2019-10-21 19:23:34.312810')
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.