Yes. That works. I think that the parser should work properly either way.
it works properly. just the proper way of functioning is not the one you would like to have.
you can simply add this operator:
CREATE FUNCTION not_equals_minus(int8, int8) RETURNS bool AS $BODY$
SELECT $1 <> -$2;
$BODY$ LANGUAGE SQL IMMUTABLE STRICT;
CREATE OPERATOR !=- (
leftarg = int8,
rightarg = int8,
procedure = not_equals_minus,
commutator = !=-
);
and then:
> select 1!=-2;
?column?
----------
t
(1 row)
depesz