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


Wed, 13 Jun 2001 16:37:16 +0200
Jean-Michel POURE <jm.poure@freesurf.fr>
SELECT Field1 || Field2 FROM Table
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
> 
> 


Wed, 13 Jun 2001 11:49:03 -0400 (EDT)
Alex Pilosov <alex@pilosoft.com>
Re: SELECT Field1 || Field2 FROM Table