From: Geert Janssens <info@kobaltwit.be>
To: pgsql-odbc@postgresql.org
Subject: '= NULL' is not the same as 'IS NULL'
Date: Wed, 6 Sep 2006 15:55:12 +0200
Message-ID: <200609061555.13070.info@kobaltwit.be> (raw)
Hi,
I managed to fix my write conflict problems in Ms Access. Now I already
stumble upon another issue:
I have a psqlODBC linked table 'tarticles' in my Ms Access 2000 application,
and a form 'Artikels' to make changes to this table. One peculiarity of this
form is, that one of the varchar fields gets set programmatically.
For example, when I create a new record, and save it (by moving to a new empty
record), I find this in the commlog:
conn=995a250, query='INSERT INTO "public"."tarticles"
("vendorid","reference","category","type","islot","amount","invoicecurrency",
"invoiceprice","priceunit","pricecustomer","invoiceid","check","label","imgname","amountlot")
VALUES
(235,'00-00007',2,7,'1','100',1,'100','1','0',921,'0','Diverse',NULL,'100')'
The field imgname was set to NULL programmatically.
When I move one record back in the form, to the record that I just added, it
will show #deleted# in every field.
This move back is represented in the commlog by:
conn=995a250, query='declare "SQL_CUR0995ED90" cursor with hold for
SELECT "public"."tarticles"."articleid" FROM "public"."tarticles"
WHERE "vendorid" = 235 AND "reference" = '00-00007' AND "category" = 2
AND "type" = 7 AND "islot" = '1' AND "amount" = '100' AND "invoicecurrency" =
1 AND "invoiceprice" = '100' AND "priceunit" = '1' AND "pricecustomer" = '0'
AND "invoiceid" = 921 AND "check" = '0' AND "label" = 'Diverse' AND
"imgname" = NULL AND "amountlot" = '100''
I tried this query directly in phpPgSQL, and indeed it returns no results. On
the other hand, if I modify "imgname" = NULL to "imgname" IS NULL, the query
works fine.
I found references via google that '= NULL' and 'IS NULL' are not the same
thing as far as PostgreSQL is concerned, which I understand.
They even provide a runtime command to override this:
SET transform_null_equals TO ON;
Unfortunatly it seems this should be called before each query that is
affected. It's not set globally.
So I'm not sure how I can solve this issue. I could work around it and make
sure no NULL values can happen, but I wonder if there might be an easier way
by means of a preference setting in Access or psqlODBC or PostgreSQL.
Has anybody else stumbled upon this issue ?
Thanks,
Geert
--
Kobalt W.I.T.
Web & Information Technology
Brusselsesteenweg 152
1850 Grimbergen
Tel : +32 479 339 655
Email: info@kobaltwit.be
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: info@kobaltwit.be
Subject: Re: '= NULL' is not the same as 'IS NULL'
In-Reply-To: <200609061555.13070.info@kobaltwit.be>
References: <200609061555.13070.info@kobaltwit.be>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox