1

I was upgrading the Ruby on Rails application from 6.0 to 6.1. When checking the start_date which is having having extra precision value when it comes to 6.1

2.7.0 :001 > User.last.created_at
  User Load (11.4ms)  SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT $1  [["LIMIT", 1]]
 => Sat, 10 Oct 2015 11:36:14.042865000 UTC +00:00 
2.7.0 :002 > 

When it comes to 6.0, we are no longer has this issue, it is having below values.

2.7.0 :001 > User.last.created_at
  User Load (2.0ms)  SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT $1  [["LIMIT", 1]]
 => Sat, 10 Oct 2015 11:36:14 UTC +00:00 
2.7.0 :002 > 

Which is causing all the specs to fails. The database used is postgres and I have research on this and there is not much of a fix on this. The field is timestamp field and it is not a precision value encoded.

Anoob K Bava
  • 598
  • 7
  • 19
  • 1
    This is just a change in `DateTime#inspect` and has nothing to do with the underlying data type. You shouldn't be relying on this output anyways besides when you're debugging. Do you have an example of the broken specs or code? – max Dec 14 '22 at 15:32
  • As @max said, your database has always had the value with high precision stored in the field. You're just seeing a more detailed value now. If your specs were relying on low precision then your specs are wrong. – anothermh Dec 14 '22 at 20:07

0 Answers0