Tom Lane wrote:
Applied with some editorializing. In particular, I don't believe the original did the right thing with (a - (b - c)).
Oops, missed that case... But now, we have (a + ( b + c)) again. A patch that removes parentheses for + and * is appended.
Regards, Andfdsa
Index: backend/utils/adt/ruleutils.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/adt/ruleutils.c,v retrieving revision 1.147 diff -c -r1.147 ruleutils.c *** backend/utils/adt/ruleutils.c 30 Jul 2003 22:56:23 -0000 1.147 --- backend/utils/adt/ruleutils.c 31 Jul 2003 09:32:15 -0000 *************** *** 2547,2552 **** --- 2547,2559 ---- if (node == (Node *) lfirst(((OpExpr *) parentNode)->args)) return true; + /* + * Exception: for * and +, ordering doesn't matter + */ + if ((*op == '+' && *parentOp == '+') || + (*op == '*' && *parentOp == '*')) + return true; + return false; } /* else do the same stuff as for T_SubLink et al. */
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings