{"action":"created","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/449","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/449/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/449/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/449/events","html_url":"https://github.com/npgsql/npgsql/pull/449","id":53313263,"number":449,"title":"Fix tests errors","user":{"login":"franciscojunior","id":829924,"avatar_url":"https://avatars.githubusercontent.com/u/829924?v=3","gravatar_id":"","url":"https://api.github.com/users/franciscojunior","html_url":"https://github.com/franciscojunior","followers_url":"https://api.github.com/users/franciscojunior/followers","following_url":"https://api.github.com/users/franciscojunior/following{/other_user}","gists_url":"https://api.github.com/users/franciscojunior/gists{/gist_id}","starred_url":"https://api.github.com/users/franciscojunior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franciscojunior/subscriptions","organizations_url":"https://api.github.com/users/franciscojunior/orgs","repos_url":"https://api.github.com/users/franciscojunior/repos","events_url":"https://api.github.com/users/franciscojunior/events{/privacy}","received_events_url":"https://api.github.com/users/franciscojunior/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-03T19:40:19Z","updated_at":"2015-01-05T17:53:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/npgsql/npgsql/pulls/449","html_url":"https://github.com/npgsql/npgsql/pull/449","diff_url":"https://github.com/npgsql/npgsql/pull/449.diff","patch_url":"https://github.com/npgsql/npgsql/pull/449.patch"},"body":"This pull request fixes some errors in the tests.\r\nPlease, don't merge it yet. WIP\r\n"},"comment":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/comments/68746774","html_url":"https://github.com/npgsql/npgsql/pull/449#issuecomment-68746774","issue_url":"https://api.github.com/repos/npgsql/npgsql/issues/449","id":68746774,"user":{"login":"franciscojunior","id":829924,"avatar_url":"https://avatars.githubusercontent.com/u/829924?v=3","gravatar_id":"","url":"https://api.github.com/users/franciscojunior","html_url":"https://github.com/franciscojunior","followers_url":"https://api.github.com/users/franciscojunior/followers","following_url":"https://api.github.com/users/franciscojunior/following{/other_user}","gists_url":"https://api.github.com/users/franciscojunior/gists{/gist_id}","starred_url":"https://api.github.com/users/franciscojunior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franciscojunior/subscriptions","organizations_url":"https://api.github.com/users/franciscojunior/orgs","repos_url":"https://api.github.com/users/franciscojunior/repos","events_url":"https://api.github.com/users/franciscojunior/events{/privacy}","received_events_url":"https://api.github.com/users/franciscojunior/received_events","type":"User","site_admin":false},"created_at":"2015-01-05T17:53:51Z","updated_at":"2015-01-05T17:53:51Z","body":"Hi, @Emill \r\n\r\nWhile checking why `VerifyFunctionWithNoParametersWithDeriveParameters`,  wasn't working (besides a missing function creation problem which was triggered by running the test alone), I noticed the following code inside `DoDeriveParameters()`\r\n```\r\nif (types == null)\r\n                        {\r\n                            if (rdr.IsDBNull(1) || rdr.GetFieldValue<uint[]>(1).Length == 0)\r\n                                return;  // Parameterless function\r\n                            types = rdr.GetFieldValue<uint[]>(1);\r\n                        }\r\n```\r\n\r\nIt was giving problems in the `rdr.GetFieldValue<uint[]>(1)` with the exception `The parameter is not of the correct format.`\r\n\r\nThe problem seems to be the following:\r\n```\r\nnpgsql_tests=# select proargnames is null, proargtypes is null, proallargtypes is null, proargmodes is null from pg_proc where proname = 'funcb';\r\n ?column? | ?column? | ?column? | ?column? \r\n----------+----------+----------+----------\r\n t        | f        | t        | t\r\n``` \r\n\r\nYes, it seems that for all other columns, proargnames, proallargtypes etc, the value returned for a parameterless function is null, except proargtypes! :)\r\n\r\nIt returns an empty string, and this was giving problems when the oid handler tried to get a number from it:\r\n```\r\nuintArr[i] = uint.Parse(stringArr[i]);\r\n```\r\n\r\n\r\nI thought fixing this problem in the DoDeriveParameter to handle this specific case, but I ended up fixing in the OidHandler itself. From what DoDeriveParameter expect, I think the idea of the GetFieldValue<uint[]> would be to really return an empty array in case of a empty string response.\r\n\r\nSo, this is the change I did to make it work:\r\n\r\n```\r\ndiff --git a/Npgsql/TypeHandlers/InternalTypesHandlers/OIDVectorHandler.cs b/Npgsql/TypeHandlers/InternalTypesHandlers/OIDVectorHandler.cs\r\nindex b3060e2..88317a9 100644\r\n--- a/Npgsql/TypeHandlers/InternalTypesHandlers/OIDVectorHandler.cs\r\n+++ b/Npgsql/TypeHandlers/InternalTypesHandlers/OIDVectorHandler.cs\r\n@@ -15,6 +15,8 @@ internal class OIDVectorHandler : TypeHandler<uint[]>\r\n         static readonly NpgsqlDbType?[] _npgsqlDbTypes = { NpgsqlDbType.Oidvector };\r\n         internal override NpgsqlDbType?[] NpgsqlDbTypes { get { return _npgsqlDbTypes; } }\r\n \r\n+        static readonly uint[] _zeroLengthArray = new uint[0];\r\n+\r\n         public override bool AllowAutoInferring { get { return false; } }\r\n \r\n         public override uint[] Read(NpgsqlBuffer buf, Messages.FieldDescription fieldDescription, int len)\r\n@@ -22,7 +24,10 @@ public override uint[] Read(NpgsqlBuffer buf, Messages.FieldDescription fieldDes\r\n             switch (fieldDescription.FormatCode)\r\n             {\r\n                 case FormatCode.Text:\r\n-                    string[] stringArr = buf.ReadString(len).Split(' ');\r\n+                    string dataFromBuffer = buf.ReadString(len);\r\n+                    if (dataFromBuffer.Length == 0) { return _zeroLengthArray;}\r\n+\r\n+                    string[] stringArr = dataFromBuffer.Split(' ');\r\n                     uint[] uintArr = new uint[stringArr.Length];\r\n                     for (var i = 0; i < stringArr.Length; i++)\r\n                         uintArr[i] = uint.Parse(stringArr[i]);\r\n\r\n```\r\n\r\nWhat do you think?\r\n\r\nIf you are ok with it, I can create a pull request for it.\r\n\r\nI also think we should add some tests for those cases where an empty string is returned from the database where an uint[] was expected. Not only for uint[] but for other array types as well."}}