Re: error codes for ln(), power()

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: error codes for ln(), power()
Date: 2004-05-15 21:43:22
Message-ID: 1084657401.25578.109.camel@tokyo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
numeric-func-errcodes-2.patch text/x-patch 8.0 KB

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2004-05-15 21:45:00 Re: YA dollar quoting patch
Previous Message Tom Lane 2004-05-15 16:07:35 Re: nested transactions