{"action":"created","issue":{"url":"https://api.github.com/repos/CartoDB/cartodb/issues/2202","labels_url":"https://api.github.com/repos/CartoDB/cartodb/issues/2202/labels{/name}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/issues/2202/comments","events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/2202/events","html_url":"https://github.com/CartoDB/cartodb/issues/2202","id":57448525,"number":2202,"title":"Issues when changing column types","user":{"login":"rafatower","id":1914276,"avatar_url":"https://avatars.githubusercontent.com/u/1914276?v=3","gravatar_id":"","url":"https://api.github.com/users/rafatower","html_url":"https://github.com/rafatower","followers_url":"https://api.github.com/users/rafatower/followers","following_url":"https://api.github.com/users/rafatower/following{/other_user}","gists_url":"https://api.github.com/users/rafatower/gists{/gist_id}","starred_url":"https://api.github.com/users/rafatower/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafatower/subscriptions","organizations_url":"https://api.github.com/users/rafatower/orgs","repos_url":"https://api.github.com/users/rafatower/repos","events_url":"https://api.github.com/users/rafatower/events{/privacy}","received_events_url":"https://api.github.com/users/rafatower/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/CartoDB/cartodb/labels/0%20-%20Backlog","name":"0 - Backlog","color":"CCCCCC"},{"url":"https://api.github.com/repos/CartoDB/cartodb/labels/backend","name":"backend","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"gfiorav","id":4222826,"avatar_url":"https://avatars.githubusercontent.com/u/4222826?v=3","gravatar_id":"","url":"https://api.github.com/users/gfiorav","html_url":"https://github.com/gfiorav","followers_url":"https://api.github.com/users/gfiorav/followers","following_url":"https://api.github.com/users/gfiorav/following{/other_user}","gists_url":"https://api.github.com/users/gfiorav/gists{/gist_id}","starred_url":"https://api.github.com/users/gfiorav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfiorav/subscriptions","organizations_url":"https://api.github.com/users/gfiorav/orgs","repos_url":"https://api.github.com/users/gfiorav/repos","events_url":"https://api.github.com/users/gfiorav/events{/privacy}","received_events_url":"https://api.github.com/users/gfiorav/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/CartoDB/cartodb/milestones/49","html_url":"https://github.com/CartoDB/cartodb/milestones/Horcajo%20de%20Santiago","labels_url":"https://api.github.com/repos/CartoDB/cartodb/milestones/49/labels","id":1312580,"number":49,"title":"Horcajo de Santiago","description":"","creator":{"login":"xavijam","id":132146,"avatar_url":"https://avatars.githubusercontent.com/u/132146?v=3","gravatar_id":"","url":"https://api.github.com/users/xavijam","html_url":"https://github.com/xavijam","followers_url":"https://api.github.com/users/xavijam/followers","following_url":"https://api.github.com/users/xavijam/following{/other_user}","gists_url":"https://api.github.com/users/xavijam/gists{/gist_id}","starred_url":"https://api.github.com/users/xavijam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xavijam/subscriptions","organizations_url":"https://api.github.com/users/xavijam/orgs","repos_url":"https://api.github.com/users/xavijam/repos","events_url":"https://api.github.com/users/xavijam/events{/privacy}","received_events_url":"https://api.github.com/users/xavijam/received_events","type":"User","site_admin":false},"open_issues":90,"closed_issues":4,"state":"open","created_at":"2015-09-18T10:14:37Z","updated_at":"2015-10-01T09:39:30Z","due_on":"2015-10-14T22:00:00Z","closed_at":null},"comments":2,"created_at":"2015-02-12T11:29:44Z","updated_at":"2015-10-01T10:11:37Z","closed_at":null,"body":"How to reproduce:\r\n1. Create a new table\r\n2. Change the `description` column type to `date`\r\n3. Change the `description` column type to `number`\r\n\r\nThe server responds with an error:\r\n```\r\nPUT https://team.cartodb.com/u/rtorre/api/v1/tables/untitled_table/columns/description\r\nparams: {\"name\":\"description\",\"type\":\"number\"}\r\nresponse: {\"errors\":[\"PG::Error: ERROR:  function cartodb.cdb_datetonumber(timestamp with time zone) does not exist\"]}\r\n```\r\nReproduced in master."},"comment":{"url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments/144686398","html_url":"https://github.com/CartoDB/cartodb/issues/2202#issuecomment-144686398","issue_url":"https://api.github.com/repos/CartoDB/cartodb/issues/2202","id":144686398,"user":{"login":"gfiorav","id":4222826,"avatar_url":"https://avatars.githubusercontent.com/u/4222826?v=3","gravatar_id":"","url":"https://api.github.com/users/gfiorav","html_url":"https://github.com/gfiorav","followers_url":"https://api.github.com/users/gfiorav/followers","following_url":"https://api.github.com/users/gfiorav/following{/other_user}","gists_url":"https://api.github.com/users/gfiorav/gists{/gist_id}","starred_url":"https://api.github.com/users/gfiorav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfiorav/subscriptions","organizations_url":"https://api.github.com/users/gfiorav/orgs","repos_url":"https://api.github.com/users/gfiorav/repos","events_url":"https://api.github.com/users/gfiorav/events{/privacy}","received_events_url":"https://api.github.com/users/gfiorav/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T10:11:37Z","updated_at":"2015-10-01T10:11:37Z","body":"The problem seems to be that our date format for tables includes the time zone (UTC) and the `CDB_DateToNumber()` expects `timestamp`, not `timestamp WITH TIME ZONE`.\r\n\r\nFrom the UI it doesn't seem posible to specify the time zone (defaulted to UTC).\r\n\r\nThe way I see it, we can either:\r\n1. Change `CDB_DateToNumber()` to expect time zones and add an extra cast in case no timezone is present (i.e.: `::TIMESTAMP WITH TIME ZONE`)\r\n2. Change de backend code to try to convert everything to UTC\r\n\r\nI'm going for 1. since it's the most format flexible (not enforcing time zones on users' data).\r\n"}}