The following bug has been logged on the website:
Bug reference: 13768
Logged by: Roman
Email address: awasarax(at)yandex(dot)ru
PostgreSQL version: 9.5beta1
Operating system: Windows (7, Server 2008 r2)
Description:
if "d" is null then return = null
else
return <> null
CREATE OR REPLACE FUNCTION userfunc(jsonb)
RETURNS jsonb AS
$BODY$
DECLARE
r jsonb = null;
d jsonb = null;
BEGIN
SELECT to_json(users.*) INTO r FROM users WHERE ///////;
RETURN r||d; -- return null
END;
$BODY$
LANGUAGE plpgsql VOLATILE;