Thread: ERROR: commutator operator - is already the commutator of operator +

ERROR: commutator operator - is already the commutator of operator +

From
shohorab hossain
Date:

Whenever I try to restore a dump database backup to PostgreSQL version 17.1, I receive the following error log. The dump is from PostgreSQL version 15.8.

What is this error and how can I fix it?.

pg_restore: error: could not execute query: ERROR: commutator operator - is already the commutator of operator +

Command was: CREATE OPERATOR adempiere.- (

FUNCTION = adempiere.subtractdays,

LEFTARG = interval,

RIGHTARG = numeric,

COMMUTATOR = OPERATOR(adempiere.-)

);



pg_restore: error: could not execute query: ERROR: operator does not exist: interval adempiere.- numeric

Command was: ALTER OPERATOR adempiere.- (interval, numeric) OWNER TO adempiere;


With Best Regards

Shohorab Hossain

shohorab hossain <shohorab23@gmail.com> writes:
>  Whenever I try to restore a dump database backup to PostgreSQL version
> 17.1, I receive the following error log. The dump is from PostgreSQL
> version 15.8.

> What is this error and how can I fix it?.
> pg_restore: error: could not execute query: ERROR: commutator operator - is
> already the commutator of operator +

v17 is complaining about a logically-inconsistent situation that
earlier versions did not notice.  You have interval - numeric
claiming to be the commutator of numeric - interval, which seems
fine --- but according to this error message, numeric - interval
is claiming to be the commutator of interval + numeric.  If these
operators have anything like the semantics their names suggest,
that commutator linkage is a bug in the operator's definition.
You need to get rid of it, or better adjust it to point to the
right operator, ie interval - numeric.

We don't have any syntax for adjusting the commutator link
once set, but maybe you could manually edit the dump file.

            regards, tom lane