Skip site navigation (1) Skip section navigation (2)

Re: Bug #604: string join problem

From: Erol Ozcan <erol(at)infotron(dot)com(dot)tr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #604: string join problem
Date: 2002-02-26 16:36:02
Message-ID: (view raw or whole thread)
Lists: pgsql-bugs
Tom Lane wrote:

> pgsql-bugs(at)postgresql(dot)org writes:
> > I have a major problem with string joining in sql query in Postgresql 7.1.3. It is always return null string if any of column has null value.
> This is not a bug.  SQL92 6.13 general rule 2a saith:
>             a) If either S1 or S2 is the null value, then the result of the
>               <concatenation> is the null value.
> Consider using something like
>         COALESCE(col1,'') || COALESCE(col2,'') || ...
> if you want to treat NULLs as empty strings.  Also consider whether you
> shouldn't have stored the fields as empty strings in the first place.
> NULL and empty string are not at all the same thing; if your data design
> treats them as interchangeable then your design is broken, IMHO.
>                         regards, tom lane

Thanks for the reply. COALESCE is working good, however,  I wrote a PL/pgSQL procedure to get more proper results.

Best Regards,
Erol Ozcan                    mailto:erol(at)infotron(dot)com(dot)tr
Software Engineer
                                     Tel: +90-216-4921002
info(+)TRON  A.S                 Istanbul/Turkey

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2002-02-26 17:48:12
Subject: Re: COPY FROM is not 8bit clean
Previous:From: Darcy BuskermolenDate: 2002-02-26 16:30:01
Subject: Re: COPY FROM is not 8bit clean

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group