Re: Optimize constant MinMax expressions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Optimize constant MinMax expressions
Date: 2018-12-30 18:44:59
Message-ID: 18620.1546195499@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> writes:
> On 30/12/2018 00:36, Tom Lane wrote:
>> Can we assume that the underlying datatype comparison function is
>> immutable? I guess so, since we assume that in nearby code such as
>> contain_mutable_functions_walker, but I don't think it should be done
>> without at least a comment.

> Adding a comment is easy enough. How is the attached?

Pushed with a bit of wordsmithing on the comment.

>> BTW, poking around for other code involving MinMaxExpr, I notice that
>> contain_leaked_vars_walker is effectively assuming that all datatype
>> comparison functions are leakproof, an assumption I find a bit debatable.
>> Maybe it's all right, but again, it should certainly not have gone without
>> a comment.

> Surely this is out of scope for my patch?

I'd been thinking that we might just add a similar comment there, but
on reflection that doesn't seem like the right thing, so I started a
separate thread about it.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chapman Flack 2018-12-30 19:06:41 Re: PostgreSQL vs SQL/XML Standards
Previous Message Tom Lane 2018-12-30 18:24:02 Is MinMaxExpr really leakproof?