Thread: Re: Sqlstatement with !=-1 fails
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
"Dave Cramer" <Dave@micro-automation.net> writes: > 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 This is not a bug. It's a consequence of wanting to allow user-definable multicharacter operator names. See the rules about allowable operator names, http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/sql-syntax.html#SQL-SYNTAX-OPERATORS regards, tom lane PS: no, != is not an SQL-standard operator name ... <> is.