{"action":"opened","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/488","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/488/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/488/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/488/events","html_url":"https://github.com/npgsql/npgsql/issues/488","id":58042846,"number":488,"title":"Null bytes in string raises: 08P01, 'invalid message format'","user":{"login":"and-se","id":11057112,"avatar_url":"https://avatars.githubusercontent.com/u/11057112?v=3","gravatar_id":"","url":"https://api.github.com/users/and-se","html_url":"https://github.com/and-se","followers_url":"https://api.github.com/users/and-se/followers","following_url":"https://api.github.com/users/and-se/following{/other_user}","gists_url":"https://api.github.com/users/and-se/gists{/gist_id}","starred_url":"https://api.github.com/users/and-se/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/and-se/subscriptions","organizations_url":"https://api.github.com/users/and-se/orgs","repos_url":"https://api.github.com/users/and-se/repos","events_url":"https://api.github.com/users/and-se/events{/privacy}","received_events_url":"https://api.github.com/users/and-se/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-18T09:07:55Z","updated_at":"2015-02-18T09:07:55Z","closed_at":null,"body":"Hello! As you know, PostgreSQL doesn't support null bytes in strings. For example, such query doesn't work:\r\n> SELECT * from testTable where textColumn = E'string with null \\0\\0\\0 byte';\r\n\r\nIf you try run this query in pgAdmin, you'll get:\r\n> ERROR:  invalid byte sequence for encoding \"UTF8\": 0x00\r\n\r\nBut Nppgsql talks about it in another way:\r\n> var cmd = new NpgsqlCommand();\r\n> cmd.Text = \"SELECT * from testTable where textColumn = :p1\";\r\n> cmd.Parameters.Add( new NpgsqlParameter(\"p1\", \"string with \\0\\0\\0 null \\0bytes\") );\r\n> cmd.ExecuteReader();\r\n> // NpgsqlException: 08P01, 'invalid message format'\r\n\r\nMaybe Npgsql need to report more clear... A string with null bytes is a strange thing, but it can come from third-party components. In my case it was IFilter.\r\n\r\nP.S.\r\nNpgsql 2.2.4.3 and 2.2.3\r\nPostgreSQL 9.4"}}