'= NULL' is not the same as 'IS NULL'

Поиск
Список
Период
Сортировка
От Geert Janssens
Тема '= NULL' is not the same as 'IS NULL'
Дата
Msg-id 200609061555.13070.info@kobaltwit.be
обсуждение исходный текст
Ответы Re: '= NULL' is not the same as 'IS NULL'  (greg.campbell@us.michelin.com)
Список pgsql-odbc
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

В списке pgsql-odbc по дате отправления:

Предыдущее
От: Geert Janssens
Дата:
Сообщение: Re: Ms Access 2000 - Update/Delete fails with Write conflict
Следующее
От: Geert Janssens
Дата:
Сообщение: Strange DELETE inconsistency