Re: SELECT Field1 || Field2 FROM Table - Mailing list pgsql-hackers

From Alex Pilosov
Subject Re: SELECT Field1 || Field2 FROM Table
Date
Msg-id Pine.BSO.4.10.10106131148190.17529-100000@spider.pilosoft.com
Whole thread Raw
In response to SELECT Field1 || Field2 FROM Table  (Jean-Michel POURE <jm.poure@freesurf.fr>)
List pgsql-hackers
Yes, that's correct behaviour. Any operation on null will yield null.

What you need to do:
select coalesce(field1,'') || coalesce(field2,'') ...

-alex

On Wed, 13 Jun 2001, Jean-Michel POURE wrote:

> Hello all,
> 
> I have PostgreSQL 7.1.1 installed on a RedHat 7.1 server.
> 
> When running the following query "SELECT Field1 || Field2 AS Result FROM Table"
> the result is NULL when Field2 is NULL.
> 
> Same as if I use a PL/pgSQL function to concatenate Filed 1 || Field2.
> 
> Did I miss something?
> 
> Regards,
> Jean-Michel POURE, pgAdmin development team
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 
> 



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Re: Improving pg_hba.conf
Next
From: Vince Vielhaber
Date:
Subject: create user problem