ruby on rails - ActiveRecord insert return PG::DatetimeFieldOverflow error -
i searched on , find answer error issue little different. have error:
pg::datetimefieldoverflow: error: date/time field value out of range: "24/05/2016 17:00" hint: perhaps need different "datestyle" setting.
if @ logs
pry(#<webexsync::sync>)> attributes => {:webex_external_id=>1025, :user_id=>2565, :lesson_times=>[2016-05-24 17:00:00 +0200], :status=>"invited"} pry(#<webexsync::sync>)> userwebex.create! attributes user load (1.4ms) select "users".* "users" "users"."id" = $1 limit 1 [["id", 2565]] webex load (0.6ms) select "webexes".* "webexes" "webexes"."external_id" = $1 order "webexes"."start_date" desc limit 1 [["external_id", 1025]] userwebex exists (0.5ms) select 1 one "user_webexes" ("user_webexes"."user_id" = 2565 , "user_webexes"."webex_external_id" = 1025) limit 1 sql (2.3ms) insert "user_webexes" ("webex_external_id", "user_id", "lesson_times", "status") values ($1, $2, $3, $4) returning "id" [["webex_external_id", 1025], ["user_id", 2565], ["lesson_times", "{24/05/2016 17:00}"], ["status", "invited"]] pg::datetimefieldoverflow: error: date/time field value out of range: "24/05/2016 17:00" hint: perhaps need different "datestyle" setting. : insert "user_webexes" ("webex_external_id", "user_id", "lesson_times", "status") values ($1, $2, $3, $4) returning "id" activerecord::statementinvalid: pg::datetimefieldoverflow: error: date/time field value out of range: "24/05/2016 17:00" hint: perhaps need different "datestyle" setting.
i cannot figure why object params ok, , date in format [2016-05-24 17:00:00 +0200]
, while saving activerecord change format in ["lesson_times", "{24/05/2016 17:00}"]
lesson_times array
as error says: hint: perhaps need different "datestyle" setting.
, , it's quite true.
here's how can set different datestyle
in pg.
set datestyle = "iso, dmy";
Comments
Post a Comment