Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZwY7D-0003oi-8S for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Nov 2015 16:19:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZwY7B-0005mL-Fc for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Nov 2015 16:19:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZwY6Z-00055j-LG for pgsql-bugs@postgresql.org; Wed, 11 Nov 2015 16:18:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZwY6X-0000qt-35 for pgsql-bugs@postgresql.org; Wed, 11 Nov 2015 16:18:39 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tABGIZd6030496; Wed, 11 Nov 2015 11:18:35 -0500 From: Tom Lane To: awasarax@yandex.ru cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13768: JSONB concat In-reply-to: <20151111115002.2643.11338@wrigleys.postgresql.org> References: <20151111115002.2643.11338@wrigleys.postgresql.org> Comments: In-reply-to awasarax@yandex.ru message dated "Wed, 11 Nov 2015 11:50:02 +0000" Date: Wed, 11 Nov 2015 11:18:35 -0500 Message-ID: <30495.1447258715@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org awasarax@yandex.ru writes: > 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; I see nothing particularly wrong here. There is long-established precedent, eg, 'foo'::text || NULL is null too. It makes sense if you consider that NULL means "unknown". regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs