Re: Sqlstatement with !=-1 fails

From: Allan Engelhardt <allane(at)cybaea(dot)com>
To: Dave Cramer <dave(at)fastcrypt(dot)com>
Subject: Re: Sqlstatement with !=-1 fails
Date: 2001-10-10 20:55:48
Message-ID: 3BC4B5D4.B77CFF2D@cybaea.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hm, SQL92 like <> for the 'not equal' operator and that parses OK:

test=# select count(*) from foo where c<>-1;
count
-------
3
(1 row)

It's probably better to use <> ... I can sort of imagine the parser getting confused in your case...

Don't know if this helps?

Allan.

Dave Cramer wrote:

> Hello,
>
> I get the following error
>
> pl=# select * from person where id !=-1;
> ERROR: Unable to identify an operator '!=-' for types 'int8' and 'int4'
> You will have to retype this query using an explicit cast
>
> pl=# select * from person where id =-1;
> id | name | last_update_time
> ----+------+------------------
> (0 rows)
>
> However this works fine
>
> pl=# select * from person where id != -1;
>
> This looks like a parser error, note the space added in the select that
> works ??
>
> Dave
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2001-10-10 20:57:04 Re: triggers
Previous Message Mitch Vincent 2001-10-10 20:51:34 Re: VACUUM, 24/7 availability and 7.2