Re: [SQL] isnull function]

From: Kachun Lee <kachun(at)pathlink(dot)com>
To: pgsql-sql(at)hub(dot)org
Subject: Re: [SQL] isnull function]
Date: 1998-06-26 20:33:17
Message-ID: 3.0.1.32.19980626133317.006bc8cc@rr.pathlink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

At 03:13 PM 6/26/98 -0400, you wrote:
>>
>> Is there an isnull function avaliable in postgres, such as:
>>
>> select isnull(dt_field, 'now') ...
>>
>> Thanks
>>
>>
>
>I don't tbink so, but it would be nice. I think Ingres has it. It also
>would not be hard to write as a loadable function.
>
>--
>Bruce Momjian | 830 Blythe Avenue
>maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
> + If your life is a hard drive, | (610) 353-9879(w)
> + Christ can be your backup. | (610) 853-3000(h)
>

I tried, but the following code does not seem to work:

#include <string.h>
#include <stdio.h>
#include "postgres.h"
#include "libpq-fe.h"
#include "utils/dt.h"

DateTime * is_null(DateTime *, DateTime *);

DateTime * is_null (DateTime * dt, DateTime * def)
{
return dt ? dt : def;
}

I searched the doc/maillist, and I could not find how to test an arg for
NULL value. Should I post this to HACKER?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Colin Dick 1998-06-26 20:41:22 Re: [SQL] isnull function]
Previous Message De Clarke 1998-06-26 19:42:20 lwn.net

Browse pgsql-sql by date

  From Date Subject
Next Message Colin Dick 1998-06-26 20:41:22 Re: [SQL] isnull function]
Previous Message Colin Dick 1998-06-26 20:28:26 Re: [SQL] Date fields and libpq....