NULL concatenation

From: Sridhar N Bamandlapally <sridhar(dot)bn1(at)gmail(dot)com>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>, PostgreSQL-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: NULL concatenation
Date: 2016-05-12 08:47:55
Message-ID: CAGuFTBXvRur3GeSAk_hNOiMdKcLAtqrpxh8PEBXGpSUxygphWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi

In migration, am facing issue with NULL concatenation in plpgsql,
by concatenating NULL between any where/position to Text / Varchar, the
total string result is setting value to NULL

*In Oracle:*

declare
txt1 VARCHAR2(100) := 'ABCD';
txt2 VARCHAR2(100) := NULL;
txt3 VARCHAR2(100) := 'EFGH';
txt VARCHAR2(100) := NULL;
begin
txt:= txt1 || txt2 || txt3;
dbms_output.put_line (txt);
end;
/

abcdefgh *===>return value*

*In Postgres*

do $$
declare
txt1 text := 'ABCD';
txt2 text := NULL;
txt3 text := 'EFGH';
txt text := NULL;
begin
txt:= txt1 || txt2 || txt3;
raise notice '%', txt;
end$$ language plpgsql;

NOTICE: <NULL> *===> return value*

SQL-Server also does same like Oracle

Is there any way alternate we have for same behavior in PostgreSQL

Please

Thanks
Sridhar
OpenText

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2016-05-12 08:52:23 Re: [HACKERS] NULL concatenation
Previous Message Andreas Joseph Krogh 2016-05-12 08:07:00 Re: index on ILIKE/LIKE - PostgreSQL 9.2

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-05-12 08:52:23 Re: [HACKERS] NULL concatenation
Previous Message Sameer Thakur-2 2016-05-12 08:42:29 Re: Declarative partitioning