Re: ERROR: operator does not exist: integer !=- integer

Поиск
Список
Период
Сортировка
Искать

Re: ERROR: operator does not exist: integer !=- integer

От:
Andrew - Supernews <andrew+nonews@supernews.com>
Дата:
On 2007-03-04, William ZHANG  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

Re: ERROR: operator does not exist: integer !=- integer

От:
Shane Ambler <pgsql@Sheeky.Biz>
Дата:
Andrew - Supernews wrote:
> On 2007-03-04, William ZHANG  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

Re: ERROR: operator does not exist: integer !=- integer

От:
"Joshua D. Drake" <jd@commandprompt.com>
Дата:
>
> 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.
>
>
>


Re: ERROR: operator does not exist: integer !=- integer

От:
"William ZHANG" <uniware@zedware.org>
Дата:
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"" 
>
> 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 



FAQ