isnull function

Started by Kachun Leeover 27 years ago1 messages
#1Kachun Lee
kachun@pathlink.com

I tried to implement an is_null function, such as:

select is_null(dt, 'now'::datetime) ...

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. Any info or help will be greately appreciated.