Thread: Re: ERROR: operator does not exist: integer !=- integer
On 2007-03-04, William ZHANG <uniware@zedware.org> wrote: > Here is the steps to reproduce it in CVS HEAD: > backend> select -1 !=-1; This arguably isn't a bug, because != is not a standard SQL operator, and therefore !=- can legitimately be defined as a single operator by the user. -- Andrew, Supernews http://www.supernews.com - individual and corporate NNTP services
Andrew - Supernews wrote: > On 2007-03-04, William ZHANG <uniware@zedware.org> wrote: >> Here is the steps to reproduce it in CVS HEAD: >> backend> select -1 !=-1; > > This arguably isn't a bug, because != is not a standard SQL operator, and > therefore !=- can legitimately be defined as a single operator by the user. > I missed the first post and can't seem to search for it - so correct me if I am missing something. Isn't the problem here a missing space? != is a valid operator and -1 is the value you are comparing to. !=-1 is not valid but != -1 is correct and what I assume you are looking to achieve. The negation operator goes with the int being negated and is not part of the comparison operator != the space is needed there to separate the two. -- Shane Ambler pgSQL@Sheeky.Biz Get Sheeky @ http://Sheeky.Biz
> > I missed the first post and can't seem to search for it - so correct > me if I am missing something. > > Isn't the problem here a missing space? != is a valid operator and -1 > is the value you are comparing to. !=-1 is not valid but != -1 is > correct and what I assume you are looking to achieve. > Well yes it will work if you add a space, but technically the problem is the query should be written like this: 1 <>-1 or 1 <> -1 Joshua D. Drake > The negation operator goes with the int being negated and is not part > of the comparison operator != the space is needed there to separate > the two. > > >
I get it. scan.l converts '!=' to '<>': 644 /* Convert "!=" operator to "<>" for compatibility */ 645 if (strcmp(yytext, "!=") == 0) 646 yylval.str = pstrdup("<>"); 647 else 648 yylval.str = pstrdup(yytext); ""Joshua D. Drake"" <jd@commandprompt.com> > > Well yes it will work if you add a space, but technically the problem is > the query should be written like this: > > 1 <>-1 or 1 <> -1 > > Joshua D. Drake