Re: case when evaluating else condition anyway? - Mailing list pgsql-general

From Sam Mason
Subject Re: case when evaluating else condition anyway?
Date
Msg-id 20081126141844.GX2459@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to case when evaluating else condition anyway?  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Responses Re: case when evaluating else condition anyway?  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
List pgsql-general
On Wed, Nov 26, 2008 at 02:53:07PM +0100, Ivan Sergio Borgonovo wrote:
> case when ''=extinput then null else extinput::timestamp end

I'd tend to use nullif(extinput,'')::timestamp for this sort of thing.
It's not going to do anything much different from what you're doing, but
may end up evaluating "extinput" less which may be a good thing.

> Is there any cleaner functional way that doesn't involve prepared
> statement etc... since the whole exercise is caused by an
> null-impaired DB API (aka MySQLish).

As Tom said, maybe if you could send a larger example it would help.


  Sam

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: case when evaluating else condition anyway?
Next
From: "Ronald Vyhmeister"
Date:
Subject: Problem with langage encoding