Re: error codes for ln(), power() - Mailing list pgsql-patches

From Neil Conway
Subject Re: error codes for ln(), power()
Date
Msg-id 1084657401.25578.109.camel@tokyo
Whole thread Raw
In response to Re: error codes for ln(), power()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
On Sat, 2004-05-15 at 11:52, Tom Lane wrote:
> But the spec hasn't even got log(), so it can hardly be thought to be
> taking a position on what error codes log() should return.  I think
> log() should use the same error codes as ln().

Point taken, I've made this change.

> You might consider changing the explication of the state code to INVALID
> ARGUMENT FOR LOGARITHM, omitting the word NATURAL.

Done.

> I don't think trunc() is portable ... we certainly don't use it anywhere
> else.  May I suggest rint() instead?  Or floor()?

trunc() is C99, but we may as well use floor(), which is C89.

I've attached a revised patch. It incorporates your suggestions, and
makes one additional change: the SQL standard defines sqrt(x) as
power(x, 0.5) -- therefore, ISTM that sqrt(-whatever) should emit the
"invalid argument to power function" SQLSTATE code.

Barring any objections, I'll apply this patch tonight (... or as soon as
CVS is back up).

-Neil


Attachment

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: YA dollar quoting patch
Next
From: Tom Lane
Date:
Subject: Re: nested transactions