{"action":"created","issue":{"url":"https://api.github.com/repos/nahanni/rw_redis_fdw/issues/11","repository_url":"https://api.github.com/repos/nahanni/rw_redis_fdw","labels_url":"https://api.github.com/repos/nahanni/rw_redis_fdw/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/nahanni/rw_redis_fdw/issues/11/comments","events_url":"https://api.github.com/repos/nahanni/rw_redis_fdw/issues/11/events","html_url":"https://github.com/nahanni/rw_redis_fdw/issues/11","id":190333855,"number":11,"title":"segfault postgresql on null key in redisIterateForeignScan","user":{"login":"dumbuzz","id":2011132,"avatar_url":"https://avatars.githubusercontent.com/u/2011132?v=3","gravatar_id":"","url":"https://api.github.com/users/dumbuzz","html_url":"https://github.com/dumbuzz","followers_url":"https://api.github.com/users/dumbuzz/followers","following_url":"https://api.github.com/users/dumbuzz/following{/other_user}","gists_url":"https://api.github.com/users/dumbuzz/gists{/gist_id}","starred_url":"https://api.github.com/users/dumbuzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dumbuzz/subscriptions","organizations_url":"https://api.github.com/users/dumbuzz/orgs","repos_url":"https://api.github.com/users/dumbuzz/repos","events_url":"https://api.github.com/users/dumbuzz/events{/privacy}","received_events_url":"https://api.github.com/users/dumbuzz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-18T14:36:39Z","updated_at":"2016-11-22T09:35:52Z","closed_at":null,"body":"Caught segfault of postgresql master process on null key.\r\nSQL-query:\r\n`select array_agg(rdva.value order by rdva.index) into m_visitor_actions\r\n     from redis_db0_visitor_actions as rdva\r\n     where key = var_visitorActionKeyPrefix || var_visitorID || var_date_suffix;`\r\nDue to expression in where clause, the key in redis_fdw.c parse_where_clause sometimes (due to postgresql planner behavior of precalulating and caching where clauses) obtain null-value (logging with  message: unable to process subexpr type 311).\r\n\r\nredis_db0_visitor_actions  is of redistype \"list\".\r\n\r\nThen in redisIterateForeignScan function it send null key to hiredis redisCommand (LLEN in my case), which segfaults master postgresql process, because hiredis can't work with null values for keys.\r\n\r\nTo prevent this, it needs to add NULL-check for key in all redisCommand calls inside redisIterateForeignScan where key is mandatory argument."},"comment":{"url":"https://api.github.com/repos/nahanni/rw_redis_fdw/issues/comments/262191547","html_url":"https://github.com/nahanni/rw_redis_fdw/issues/11#issuecomment-262191547","issue_url":"https://api.github.com/repos/nahanni/rw_redis_fdw/issues/11","id":262191547,"user":{"login":"dumbuzz","id":2011132,"avatar_url":"https://avatars.githubusercontent.com/u/2011132?v=3","gravatar_id":"","url":"https://api.github.com/users/dumbuzz","html_url":"https://github.com/dumbuzz","followers_url":"https://api.github.com/users/dumbuzz/followers","following_url":"https://api.github.com/users/dumbuzz/following{/other_user}","gists_url":"https://api.github.com/users/dumbuzz/gists{/gist_id}","starred_url":"https://api.github.com/users/dumbuzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dumbuzz/subscriptions","organizations_url":"https://api.github.com/users/dumbuzz/orgs","repos_url":"https://api.github.com/users/dumbuzz/repos","events_url":"https://api.github.com/users/dumbuzz/events{/privacy}","received_events_url":"https://api.github.com/users/dumbuzz/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T09:35:52Z","updated_at":"2016-11-22T09:35:52Z","body":"yes, I test your fix....correct.....no segfault now, just error \"key is NULL\" - it's what should be excpected"}}
{"actor":{"display_login":"dumbuzz"}}