pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gene Selkov Jr. <selkovjr@xnet.com>
To: Byron Nikolaidis <byronn@insightdist.com>
To: pgsql-interfaces@postgreSQL.org
To: pgsql-hackers@postgreSQL.org
Subject: Re: [INTERFACES] Foreign Keys
Date: Wed, 03 Mar 1999 02:04:39 -0500
Message-ID: <199903030802.CAA12326@mail.xnet.com> (raw)
In-Reply-To: <36DC61D6.6DF4E87D@insightdist.com>


> The second problem is this:
> 
> conn=153237224, query='SELECT "RentalOrders"."rentalorderlinesid" FROM "rentalorderlines"
> "RentalOrders" WHERE ("rentalorderid" =  NULL ) '
> ERROR from backend during send_query: 'ERROR:  parser: parse error at or near "null"'
> STATEMENT ERROR: func=SC_execute, desc='', errnum=1, errmsg='Error while executing the query'
> 
> 
> Since postgres will not recognize the syntax (where 'col' = null)...  it only recognizes
> "isnull".  I was hoping someone would have added the ability for the parser to handle this at
> some point (Hey Dave, maybe you could contribute something here man :-).
> 
> 
> Byron
> 

I do not poke my nose into odbc as I have nothing to do with it, but
this parsing problem caught my attention. To me, 'isnull' and '= null'
are the same token. So I fixed the aforementioned problem like this:

1. In backend/parser.scan.l, find the line that reads:

identifier              {letter}{letter_or_digit}*

and put this following macro after it:

isnull                  ={space}*(null|NULL)

it does not matter where before the beginning of the rules section you
will put it, but it is better to keep related things close to each other.


2. In the same file, find the line that reads:

{identifier}    {

and insert the following rule before it

{isnull}        {
            int i;
            ScanKeyword             *keyword;

            for(i = 0; yytext[i]; i++)
                    if (isascii((unsigned char)yytext[i]) &&
                            isupper(yytext[i]))
                            yytext[i] = tolower(yytext[i]);
            if (i >= NAMEDATALEN)
                    yytext[NAMEDATALEN-1] = '\0';

            keyword = ScanKeywordLookup((char*)"isnull");
            return keyword->value;
    }

3. run make && make install in the src directory, then stop and restart postmaster


I understand it is an ugly hack but if you are desperate to get things running ...
If you don't try to use it as NULL = 'col', you should be OK.

--Gene



view thread (24+ messages)  latest in thread

Message-ID: <199903030802.CAA12326@mail.xnet.com>
Permalink:  ../199903030802.CAA12326@mail.xnet.com/
Also on:    postgresql.org/message-id/199903030802.CAA12326@mail.xnet.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: selkovjr@xnet.com, byronn@insightdist.com, pgsql-hackers@postgreSQL.org
  Subject: Re: [INTERFACES] Foreign Keys
  In-Reply-To: <199903030802.CAA12326@mail.xnet.com>

* 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