Re: Add Nullif case for eval_const_expressions_mutator

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Steele <david@pgmasters.net>
Cc: "Hou, Zhijie" <houzj.fnst@cn.fujitsu.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-03-23T15:45:37Z
Lists: pgsql-hackers
David Steele <david@pgmasters.net> writes:
> Peter, thoughts on the new patch in [1]?

I'm not Peter, but I have a complaint about this bit:

+				if (!has_nonconst_input)
+					return ece_evaluate_expr(expr);

That's not okay without a further check to see if the comparison function
used by the node is immutable.  Compare ScalarArrayOpExpr, for instance.

			regards, tom lane



Commits

  1. Add support for NullIfExpr in eval_const_expressions