Re[2]: [HACKERS] Re: [INTERFACES] Odbc parser error

From: Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it>
To: Byron Nikolaidis <byronn(at)insightdist(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re[2]: [HACKERS] Re: [INTERFACES] Odbc parser error
Date: 1998-10-26 16:22:25
Message-ID: 6723.981026@bo.nettuno.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

Hi all,

JS> Yes, I would to suggest a way to solve this problem because in Access we
JS> can't link two tables
JS> by a numeric field, for example:

JS> I have 2 tables:

JS> ORDER_MASTER: ORDER_DETAIL:
JS> -------------- --------------
JS> numero SERIAL <---> numero SERIAL
JS> ... ...

JS> When I try to create a new ORDER, the connection goes down with message:

JS> # conn=75511800, query='SELECT "order_detail"."numero" FROM
JS> "order_detail" WHERE ("numero" = NULL )'
JS> # ERROR from backend during send_query: 'ERROR: parser: parse error at
JS> or near "null"'

JS> I know this is not standard but Access understand both syntaxes (i.e.:

JS> SELECT * FROM table WHERE field IS NULL; = SELECT * FROM table
JS> WHERE field = NULL;
JS> SELECT * FROM table WHERE field IS NOT NULL; = SELECT * FROM table
JS> WHERE field <> NULL;

JS> Why not to get PostgreSQL to understand it also ?

Done. I modify the pgsql/src/backend/gram.y at line 3318 I inserted
the following two lines:

<DELETED>
3318 | a_expr '=' NULL_P
3319 { $$ = makeA_Expr(ISNULL, NULL,$1, NULL);

3320 | a_expr '=' a_expr
3321 { $$ = makeA_Expr(OP, "=", $1, $3); }
<DELETED>

now SELECT * FROM table WHERE field IS NULL;
is the same as: SELECT * FROM table WHERE field = NULL;

How about to add it to official release ?
-------------------------------------------------------------------

I think I found a bug using IS NULL operator:

hygea=> \d comuni

Table = comuni
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| istat | char() not null | 6 |
| nome | char() | 50 |
| provincia | char() | 2 |
| codice_fiscale | char() | 4 |
| cap | char() | 5 |
| regione | char() | 3 |
| distretto | char() | 4 |
+----------------------------------+----------------------------------+-------+
hygea=> select * from comuni where COMUNI is null;
^^^^^^------------------COMUNI is
not a field but the table name.

istat|nome|provincia|codice_fiscale|cap|regione|distretto
-----+----+---------+--------------+---+-------+---------
(0 rows)

Jose'

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-10-26 16:48:47 Re: [HACKERS] How do we find serial types
Previous Message D'Arcy J.M. Cain 1998-10-26 16:15:27 Re: [HACKERS] How do we find serial types

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter T Mount 1998-10-26 16:23:50 Re: [INTERFACES] applet don't go
Previous Message Tom Lane 1998-10-26 16:16:11 Re: [INTERFACES] large object error