Sunday, 15 March 2015

postgresql - rails postgres date_time not working properly -


I am getting a strange error when trying to save a record with a timeout for a posttime. Sometimes this works, see the first example. Other times it does not work

  Set up "client_comments" update "comment" = $ 1, "conversation_time" = $ 2, "updated_at" = $ 3, where "client_comments". "Id" = 2 ["comment", "test2"], ["chat_time", "2015-03-09 23: 42: 00.000000"], ["update_atrat", "2015-03-16 23:50 50: 32.307101 "]]  

works, no problem

When I use a

  with a form ;;% = F.datetime_select: conversation_time, {: Start_year = & gt; 2010,: &_your = & gt; Date.today.year}%>  

I click update, the parameters are:

  Parameters: {"UTF8" => "✓", "authenticity_token" = & gt; "Iz / MS9mI3K7H0dg05AFjaiKTudLpuG3ipAtGbHEQA =", "client_comment" = & gt; {"Client_id" => 
"1221", "user_id" = "1", "company_id" = & gt; "Mon", "conversation_time (1m)" = = "2015", "conversation_time (2i)" = = "3", "conversation_time (3i)" = = "7", "conversation_time (4i)" = = "19", "conversation_time (5i)" = & gt; "42", "Comment" = & gt; "Test2"}, "comma" = & gt; "Update client comment", "id" = & gt; "2"}

is SQL:. Set the "client_comments" update to "conversation_time" = $ 1, "updated_at" = $ 2 Where "client_comments" "id" = 2 [["conversation_time", "2015-03-28 00: 42: 00.000000 "], [" updated_at "," 2015-03-17 00: 01: 43.611166 "]]

which causes this exception:

  PG :: DataTimeCancer: Error: Column "Talk_time" is the type of timestamp without the time zone, but without the expression time zone there are 52 types of characters HINT: Write or write an expression to you  

Another strange thing That is the hour in this case, 19, but it is trying to set up hours in SQL for 00, so I do not know what is going on with it.

This is my schema:

  # \ d + client_comments table "public.client_comments" column | Type | Modifier | Storage | Data targets Description ------------------- + ----------------------------- + -------------------------------------------------- ------------- + ---------- + -------------- + ---------- --- ID | Integer | Null default next line ('client_comments_id_seq' :: RegClass). Plain | | Client_id | Integer | | Plain | | User_id | Integer | | Plain | | Company_id | Integer | | Plain | | Comment | Text | | Extended | | Employee_user_id | Integer | | Plain | | Made_at | Timestamp without time zone. | Plain | | Updated_at | Timestamp without time zone. | Plain | | Chat_time | Timestamp without time zone. | Plain | | Index: "client_comments_pkey" is the OID in the primary key, btree (id) "index_client_comments_on_client_id" btree (client_id) "index_client_comments_on_company_id" btree (company_id) "index_client_comments_on_user_id" btree (user_id): not  

rail V 4.1.8 psql (9.3.2)

Good, this is not a right answer, but this address Has either been a bug with Rail 4.1 and PG 0.17.1 or they work together. I upgraded to 4.2.1 rails (now come out) and PG 0.18.1 and all is well in the end. Note PG 0.81.1 and previous versions of the Rail was a bug with Blob support, but 4.2.1 has been decided.


No comments:

Post a Comment