Re: Passing a null value in pl/pgsql

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Mike Finn <mike(dot)finn(at)tacticalExecutive(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Passing a null value in pl/pgsql
Date: 2002-01-14 22:58:52
Message-ID: 20020114145706.M27397-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mon, 14 Jan 2002, Mike Finn wrote:

> I have two stored procedures and one calls the other. If
> the caller passes a null for one of the parameters (the fourth) a delete
> query in the called function will not work.
>
> If I pass a null as the 4th parameter (_seqSalesOrderLine) the delete
> query below will not match any records, and my business rule fails. If I
> temporarily (for testing only) change the asterisked line to read
> and seqSalesOrderLine = null
> the query works as I would expect.

The only reason the above works is probably due to the hack that treats
the explicit = NULL token sequence as IS NULL which is the correct way to
compare for nulls. SQL basically wants = between a NULL value and
anything to be unknown.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-01-14 23:20:04 Re: Passing a null value in pl/pgsql
Previous Message Andrew Sullivan 2002-01-14 22:57:25 Re: 7.2 changes to varchar truncation