Heikki Linnakangas <hlinnaka@iki.fi> writes:
> On 05/11/2017 06:21 PM, Tom Lane wrote:
>>> On a side-note, I find it a bit awkward that ScalarArrayOpExpr uses a
>>> 2-element List to hold the scalar and array arguments. Wouldn't it be
>>> much more straightforward to have explicit "Expr *scalararg" and "Expr
>>> *arrayarg" fields?
>> I think it's modeled on OpExpr, which also uses a list though you could
>> argue for separate leftarg and rightarg fields instead.
> Yeah, I think that would be better for OpExpr, too. (For an unary
> operator, rightarg would be unused.)
I should think leftarg is the one that would go unused, for a normal
prefix unary operator.
But it seems like changing this would be way more invasive than it's
really worth. We'd save a couple of List cells per operator, which
is certainly something, but I'm afraid you'd be touching a heck of
a lot of code. And there are a nontrivial number of places that
share argument-processing with FuncExprs, which such a change would
break.
regards, tom lane