Re: <no subject>

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Daniel Schuchardt <daniel_schuchardt(at)web(dot)de>
Cc: PostgreSQL general list <pgsql-general(at)postgresql(dot)org>, dev(at)archonet(dot)com
Subject: Re: <no subject>
Date: 2003-10-01 10:41:43
Message-ID: 1065004903.2918.6.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2003-10-01 at 11:19, Daniel Schuchardt wrote:
> But CAST(NULL AS VARCHAR) should make it a varchar

NULL is still null, whatever you cast it to. The column type is
independent of whether one particular datum is null.

Instead of casting, you want COALESCE(field2, '') to give you an empty
string if the value is null.

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Yet if any man suffer as a Christian, let him not be
ashamed; but let him glorify God on this behalf."
I Peter 4:16

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2003-10-01 10:47:44 Re: <no subject>
Previous Message Ron Johnson 2003-10-01 10:37:25 Re: <no subject>