pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13768: JSONB concat
2+ messages / 2 participants
[nested] [flat]

* BUG #13768: JSONB concat
@ 2015-11-11 11:50 awasarax@yandex.ru
  2015-11-11 16:18 ` Re: BUG #13768: JSONB concat Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: awasarax@yandex.ru @ 2015-11-11 11:50 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      13768
Logged by:          Roman
Email address:      awasarax@yandex.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; 





-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #13768: JSONB concat
  2015-11-11 11:50 BUG #13768: JSONB concat awasarax@yandex.ru
@ 2015-11-11 16:18 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2015-11-11 16:18 UTC (permalink / raw)
  To: awasarax@yandex.ru; +Cc: pgsql-bugs

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2015-11-11 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11 11:50 BUG #13768: JSONB concat awasarax@yandex.ru
2015-11-11 16:18 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox