{"action":"created","issue":{"url":"https://api.github.com/repos/qgis/QGIS/issues/2207","labels_url":"https://api.github.com/repos/qgis/QGIS/issues/2207/labels{/name}","comments_url":"https://api.github.com/repos/qgis/QGIS/issues/2207/comments","events_url":"https://api.github.com/repos/qgis/QGIS/issues/2207/events","html_url":"https://github.com/qgis/QGIS/pull/2207","id":94314079,"number":2207,"title":"Preserve 0/NULL values from postgres int columns","user":{"login":"m-kuhn","id":588407,"avatar_url":"https://avatars.githubusercontent.com/u/588407?v=3","gravatar_id":"","url":"https://api.github.com/users/m-kuhn","html_url":"https://github.com/m-kuhn","followers_url":"https://api.github.com/users/m-kuhn/followers","following_url":"https://api.github.com/users/m-kuhn/following{/other_user}","gists_url":"https://api.github.com/users/m-kuhn/gists{/gist_id}","starred_url":"https://api.github.com/users/m-kuhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-kuhn/subscriptions","organizations_url":"https://api.github.com/users/m-kuhn/orgs","repos_url":"https://api.github.com/users/m-kuhn/repos","events_url":"https://api.github.com/users/m-kuhn/events{/privacy}","received_events_url":"https://api.github.com/users/m-kuhn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jef-n","id":238070,"avatar_url":"https://avatars.githubusercontent.com/u/238070?v=3","gravatar_id":"","url":"https://api.github.com/users/jef-n","html_url":"https://github.com/jef-n","followers_url":"https://api.github.com/users/jef-n/followers","following_url":"https://api.github.com/users/jef-n/following{/other_user}","gists_url":"https://api.github.com/users/jef-n/gists{/gist_id}","starred_url":"https://api.github.com/users/jef-n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jef-n/subscriptions","organizations_url":"https://api.github.com/users/jef-n/orgs","repos_url":"https://api.github.com/users/jef-n/repos","events_url":"https://api.github.com/users/jef-n/events{/privacy}","received_events_url":"https://api.github.com/users/jef-n/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-07-10T14:13:12Z","updated_at":"2015-07-10T22:44:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/qgis/QGIS/pulls/2207","html_url":"https://github.com/qgis/QGIS/pull/2207","diff_url":"https://github.com/qgis/QGIS/pull/2207.diff","patch_url":"https://github.com/qgis/QGIS/pull/2207.patch"},"body":"Actually, the headline only says half of it. I think this patch is fine to apply but it does not solve the underlying problem.\r\n\r\nIt seems that the check on this line here fails to properly distinguish 0 from NULL in the attributes\r\nhttps://github.com/qgis/QGIS/blob/master/src/core/qgsfeature.cpp#L97\r\n\r\nWe could as well remove the check and have some unnecessary detaches happen once in a while (not sure how often or bad that would be).\r\n\r\nThe underlying problem is that IIRC Qt returns true for `QVariant(int) == QVariant(0)` a thing that should be solved upstream. We could maybe implement our own helper method to compare QVariants and have it take care of such things.\r\n\r\n@jef-n assigning you since you are the postgres provider wizard.\r\n\r\nThoughts?"},"comment":{"url":"https://api.github.com/repos/qgis/QGIS/issues/comments/120545035","html_url":"https://github.com/qgis/QGIS/pull/2207#issuecomment-120545035","issue_url":"https://api.github.com/repos/qgis/QGIS/issues/2207","id":120545035,"user":{"login":"nyalldawson","id":1829991,"avatar_url":"https://avatars.githubusercontent.com/u/1829991?v=3","gravatar_id":"","url":"https://api.github.com/users/nyalldawson","html_url":"https://github.com/nyalldawson","followers_url":"https://api.github.com/users/nyalldawson/followers","following_url":"https://api.github.com/users/nyalldawson/following{/other_user}","gists_url":"https://api.github.com/users/nyalldawson/gists{/gist_id}","starred_url":"https://api.github.com/users/nyalldawson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyalldawson/subscriptions","organizations_url":"https://api.github.com/users/nyalldawson/orgs","repos_url":"https://api.github.com/users/nyalldawson/repos","events_url":"https://api.github.com/users/nyalldawson/events{/privacy}","received_events_url":"https://api.github.com/users/nyalldawson/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T22:44:34Z","updated_at":"2015-07-10T22:44:34Z","body":"BTW, thanks for looking into this. I'd also encountered this earlier in the week and was totally confused by what was happening..."}}