{"action":"created","issue":{"url":"https://api.github.com/repos/dimitri/pgloader/issues/222","labels_url":"https://api.github.com/repos/dimitri/pgloader/issues/222/labels{/name}","comments_url":"https://api.github.com/repos/dimitri/pgloader/issues/222/comments","events_url":"https://api.github.com/repos/dimitri/pgloader/issues/222/events","html_url":"https://github.com/dimitri/pgloader/issues/222","id":71648449,"number":222,"title":"Does not properly decode Hex-encoded characters in COPY TEXT format","user":{"login":"mbanck","id":1670301,"avatar_url":"https://avatars.githubusercontent.com/u/1670301?v=3","gravatar_id":"","url":"https://api.github.com/users/mbanck","html_url":"https://github.com/mbanck","followers_url":"https://api.github.com/users/mbanck/followers","following_url":"https://api.github.com/users/mbanck/following{/other_user}","gists_url":"https://api.github.com/users/mbanck/gists{/gist_id}","starred_url":"https://api.github.com/users/mbanck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbanck/subscriptions","organizations_url":"https://api.github.com/users/mbanck/orgs","repos_url":"https://api.github.com/users/mbanck/repos","events_url":"https://api.github.com/users/mbanck/events{/privacy}","received_events_url":"https://api.github.com/users/mbanck/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-04-28T17:14:36Z","updated_at":"2015-04-30T12:01:44Z","closed_at":"2015-04-30T11:17:07Z","body":"If a dump contains hex-encoded characters like \"\\x1a\", pgloader inserts that as a literal \"\\x1a\" string in the database, not as the hex value 0x1A. psql's \\copy copes fine:\r\n\r\n```\r\npostgres@hartree:~$ cat /tmp/test.copy\r\n1       a\r\n2       aa\r\n3       \\x1a\r\n4       a\\x1a\r\npostgres@hartree:~$ echo \"CREATE TABLE public.pgl_regress(id int, text varchar(4));\" | psql\r\nCREATE TABLE\r\npostgres@hartree:~$ echo \"\\copy pgl_regress FROM '/tmp/test.copy';\" | psql\r\nCOPY 4\r\npostgres@hartree:~$ echo \"SELECT id, text, char_length(text) FROM pgl_regress\" | psql\r\n id | text  | char_length\r\n----+-------+-------------\r\n  1 | a     |           1\r\n  2 | aa    |           2\r\n  3 | \\x1A  |           1\r\n  4 | a\\x1A |           2\r\n(4 rows)\r\npostgres@hartree:~$ cat /tmp/test.copy | pgloader --type copy --with truncate - postgresql:///postgres?public.pgl_regress\r\n2015-04-28T15:59:27.105000Z LOG Main logs in '/tmp/pgloader/pgloader.log'\r\n2015-04-28T15:59:27.112000Z LOG Data errors in '/tmp/pgloader/'\r\n                    table name       read   imported     errors            time\r\n------------------------------  ---------  ---------  ---------  --------------\r\n                         fetch          0          0          0          0.013s\r\n------------------------------  ---------  ---------  ---------  --------------\r\n            public.pgl_regress          4          3          1          0.091s\r\n------------------------------  ---------  ---------  ---------  --------------\r\n             Total import time          4          3          1          0.104s\r\n2015-04-28T15:59:27.514000Z ERROR Database error 22001: Wert zu lang fr Typ character varying(4)\r\nCONTEXT: COPY pgl_regress, Zeile 4, Spalte text: a\\x1A\r\npostgres@hartree:~$ echo \"SELECT id, text, char_length(text) FROM pgl_regress\" | psql\r\n id | text | char_length\r\n----+------+-------------\r\n  1 | a    |           1\r\n  2 | aa   |           2\r\n  3 | \\x1A |           4\r\n(3 rows)\r\npostgres@hartree:~$\r\n```\r\nAm I missing some option here?"},"comment":{"url":"https://api.github.com/repos/dimitri/pgloader/issues/comments/97749383","html_url":"https://github.com/dimitri/pgloader/issues/222#issuecomment-97749383","issue_url":"https://api.github.com/repos/dimitri/pgloader/issues/222","id":97749383,"user":{"login":"mbanck","id":1670301,"avatar_url":"https://avatars.githubusercontent.com/u/1670301?v=3","gravatar_id":"","url":"https://api.github.com/users/mbanck","html_url":"https://github.com/mbanck","followers_url":"https://api.github.com/users/mbanck/followers","following_url":"https://api.github.com/users/mbanck/following{/other_user}","gists_url":"https://api.github.com/users/mbanck/gists{/gist_id}","starred_url":"https://api.github.com/users/mbanck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbanck/subscriptions","organizations_url":"https://api.github.com/users/mbanck/orgs","repos_url":"https://api.github.com/users/mbanck/repos","events_url":"https://api.github.com/users/mbanck/events{/privacy}","received_events_url":"https://api.github.com/users/mbanck/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T12:01:44Z","updated_at":"2015-04-30T12:01:44Z","body":"Thanks a lot for the quick fix!\r\n\r\nas I don't have root on the box I ran into the problem initially, I'll try to build a similarly static binary you provided for CentOS. Did you use the pgloader-standalone target for that or is it just using the pgloader.spec file?"}}