Re: BUG #13768: JSONB concat

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: awasarax(at)yandex(dot)ru
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13768: JSONB concat
Date: 2015-11-11 16:18:35
Message-ID: 30495.1447258715@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

awasarax(at)yandex(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message wcatron 2015-11-11 22:55:32 BUG #13771: Clarify length of name for prepared statement and return error.
Previous Message postgresql.org 2015-11-11 15:50:06 BUG #13770: Extending recovery_min_apply_delay on Standby causes it to be unavailable for a while