Subject: SELECT Field1 || Field2 FROM Table

From: Jean-Michel POURE <[email-masked]>
Date: Wed, 13 Jun 2001 16:37:16 +0200

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

---

From: Alex Pilosov <[email-masked]>
Date: Wed, 13 Jun 2001 11:49:03 -0400 (EDT)

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:

> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 
>