{"action":"created","issue":{"url":"https://api.github.com/repos/ingalls/pt2itp/issues/184","repository_url":"https://api.github.com/repos/ingalls/pt2itp","labels_url":"https://api.github.com/repos/ingalls/pt2itp/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/ingalls/pt2itp/issues/184/comments","events_url":"https://api.github.com/repos/ingalls/pt2itp/issues/184/events","html_url":"https://github.com/ingalls/pt2itp/pull/184","id":257113051,"number":184,"title":"changing any null text fields to empty string","user":{"login":"boblannon","id":1092694,"avatar_url":"https://avatars3.githubusercontent.com/u/1092694?v=4","gravatar_id":"","url":"https://api.github.com/users/boblannon","html_url":"https://github.com/boblannon","followers_url":"https://api.github.com/users/boblannon/followers","following_url":"https://api.github.com/users/boblannon/following{/other_user}","gists_url":"https://api.github.com/users/boblannon/gists{/gist_id}","starred_url":"https://api.github.com/users/boblannon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boblannon/subscriptions","organizations_url":"https://api.github.com/users/boblannon/orgs","repos_url":"https://api.github.com/users/boblannon/repos","events_url":"https://api.github.com/users/boblannon/events{/privacy}","received_events_url":"https://api.github.com/users/boblannon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-09-12T16:52:51Z","updated_at":"2017-09-21T05:42:50Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/ingalls/pt2itp/pulls/184","html_url":"https://github.com/ingalls/pt2itp/pull/184","diff_url":"https://github.com/ingalls/pt2itp/pull/184.diff","patch_url":"https://github.com/ingalls/pt2itp/pull/184.patch"},"body":"Null values in `address` and `network` tables' text fields shouldn't be allowed, but they're getting created because the `COPY` commands are treating empty strings as null:\r\n\r\n```javascript\r\nfor (let child of nursery) {\r\n    netQ.defer((output, done) => {\r\n        self.pool.query(`\r\n            COPY network (text, text_tokenless, _text, geomtext)\r\n            FROM '${output}' WITH CSV DELIMITER '|' QUOTE E'\\b' NULL AS '';\r\n        `, (err) => {\r\n            if (err) return done(err);\r\n\r\n            fs.unlink(output, (err) => {\r\n                return done(err);\r\n            });\r\n        });\r\n    }, child.output);\r\n}\r\n```\r\n\r\nThat's fine, we need it for other values that are stored as empty strings in the PSV file.  it has the unfortunate side effect, though, of creating null values in the text fields.\r\n\r\n```\r\nmbpl_us_mt_address_both=# select count(*) from network;\r\n count\r\n--------\r\n 105584\r\n(1 row)\r\n\r\nmbpl_us_mt_address_both=# select count(*) from network where _text is null;\r\n count\r\n-------\r\n 45222\r\n(1 row)\r\n```"},"comment":{"url":"https://api.github.com/repos/ingalls/pt2itp/issues/comments/331057024","html_url":"https://github.com/ingalls/pt2itp/pull/184#issuecomment-331057024","issue_url":"https://api.github.com/repos/ingalls/pt2itp/issues/184","id":331057024,"user":{"login":"boblannon","id":1092694,"avatar_url":"https://avatars3.githubusercontent.com/u/1092694?v=4","gravatar_id":"","url":"https://api.github.com/users/boblannon","html_url":"https://github.com/boblannon","followers_url":"https://api.github.com/users/boblannon/followers","following_url":"https://api.github.com/users/boblannon/following{/other_user}","gists_url":"https://api.github.com/users/boblannon/gists{/gist_id}","starred_url":"https://api.github.com/users/boblannon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boblannon/subscriptions","organizations_url":"https://api.github.com/users/boblannon/orgs","repos_url":"https://api.github.com/users/boblannon/repos","events_url":"https://api.github.com/users/boblannon/events{/privacy}","received_events_url":"https://api.github.com/users/boblannon/received_events","type":"User","site_admin":false},"created_at":"2017-09-21T05:42:50Z","updated_at":"2017-09-21T05:42:50Z","author_association":"COLLABORATOR","body":"It's possible that this code is working now, but if so, it does seem to take an awfully long time."}}
{"actor":{"display_login":"boblannon"}}