On Thu, 15 Oct 2026 at 04:16, Chao Li <[email protected]> wrote: > > > > > On Oct 14, 2026, at 23:07, Tom Lane <[email protected]> wrote: > > > > Matthias van de Meent <[email protected]> writes: > > > >> So, I'd suggest something like > > > >> + if (cmp_var(, const_one) == 0) > >> + ereport(ERROR, > >> + errcode(ERRCODE_INVALID_ARGUMENT_FOR_LOG), > >> + errmsg("cannot take logarithm using base 1")); > > > > Agreed, but if we want that, we must do it for a finite second input > > too. Right now you do get > > > > regression=# select log(1, 33); > > ERROR: division by zero > > > > Chao proposes matching that, which isn't insane, but I like a > > specialized error message better. > > > > That’s why I chose that error message, because the existing test has this: > ``` > select log(1.0, 12.34); > ERROR: division by zero > ```
Ah, I see, thanks for clarifying. This wasn't quite clear from the initial post. > After thinking it over, I think we can add a check for base 1 in log_var(), > and numeric_log() can just defer base 1 handling to log_var(). Please see v2, > which implements this approach. LGTM. Kind regards, Matthias van de Meent Databricks (https://www.databricks.com)
