Re: regexp on null

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: regexp on null
Date: 2010-09-10 16:56:32
Message-ID: 482E80323A35A54498B8B70FF2B879800473BC4924@azsmsx504.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ya, I kinda knew about these approaches. The problem ahs to do with novice users who don't know about coalesce or or;ing a check ofr nulls. I was hoping there was some special regexp expression that would match to a null.

Thanks for the quick response, and have a great weekend !

-----Original Message-----
From: Richard Broersma [mailto:richard(dot)broersma(at)gmail(dot)com]
Sent: Friday, September 10, 2010 12:19 PM
To: Gauthier, Dave
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] regexp on null

On Fri, Sep 10, 2010 at 9:00 AM, Gauthier, Dave <dave(dot)gauthier(at)intel(dot)com> wrote:

> Is there a way to regexp match on a null value?

I would say no.

>  Or is it necessary to OR in a .... "or x is null"?

you could use a

COALESCE( text_column, '') ~ E'MyRegEx';

Or perhaps:
( text_column ~ E'MyRegEx' ) IS UNKNOWN
might work.

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ralph Smith 2010-09-10 17:25:52 Frustration with \copy
Previous Message Richard Broersma 2010-09-10 16:19:01 Re: regexp on null