Skip site navigation (1) Skip section navigation (2)

Re: case when evaluating else condition anyway?

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: case when evaluating else condition anyway?
Date: 2008-11-26 14:18:44
Message-ID: 20081126141844.GX2459@frubble.xen.chris-lamb.co.uk (view raw or flat)
Thread:
Lists: 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

In response to

Responses

pgsql-general by date

Next:From: Ronald VyhmeisterDate: 2008-11-26 14:40:19
Subject: Problem with langage encoding
Previous:From: Tom LaneDate: 2008-11-26 14:02:01
Subject: Re: case when evaluating else condition anyway?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group