Re: Why isn't that null - Mailing list pgsql-general

From Tom Lane
Subject Re: Why isn't that null
Date
Msg-id 8731.962095662@sss.pgh.pa.us
Whole thread Raw
In response to Why isn't that null  (Matthias Teege <matthias@mteege.de>)
List pgsql-general
Matthias Teege <matthias@mteege.de> writes:
> I have al small problem with ISNULL in a trigger
> function. My definition looks like:

> IF NEW.vkp ISNULL THEN
>    ...

> The following SQL query didnt cause this if statement:

> insert into aufpos(auftrag, artikel, best_menge, vkp,
> lieferwoche, cuser, ctime, uuser, utime) values
> ('175','8501900','12','','3500','matthias',
> now (), 'matthias',now ())

This seems correct to me --- an empty string '' is certainly not
the same thing as NULL.

> If I change the function statement as follows:

> IF NEW.vkp = 0 THEN
>    ...
> END IF;

> it works

Shouldn't that give a type error of some sort?  You didn't say
what type vkp is, but if it's a string type then comparing it
against a numeric shouldn't work IMHO.

            regards, tom lane

pgsql-general by date:

Previous
From: Lincoln Yeoh
Date:
Subject: Re: Transactions and web applications
Next
From: "Morten W. Petersen"
Date:
Subject: How to dump from Postgre