Re: Subscript expressions do not have to evaluate to integers

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, sean(at)materialize(dot)io, Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Subscript expressions do not have to evaluate to integers
Date: 2020-08-22 15:47:37
Message-ID: 20200822154737.GB26781@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Fri, Aug 21, 2020 at 07:21:30PM -0700, David G. Johnston wrote:
> On Fri, Aug 21, 2020 at 6:22 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > On Wed, Jul 22, 2020 at 02:59:18AM +0000, PG Doc comments form wrote:
> >> I believe a more appropriate statement would acknowledge that at least
> some
> >> values undergo an explicit-style conversion to an integer.
>
> > OK, how is the attached patch?
>
> "and" is not an improvement over "which".  Otherwise seems OK.

OK, done in the attached patch.

> (The proposed patch for generic subscripting will probably need to
> rewrite this completely, but for now this is an improvement.)
>
>
> I was going to add that maybe we should link to the round(dp or numeric)
> function in the documentation and let it be explicit about the rounding rules
> pertaining to half - which when I look isn't actually documented:
>
> round(dp or numeric) (same as input) round to nearest integer
>
> Maybe everyone just knows that rounding, unless otherwise stated, rounds halves
> away from zero but it doesn't seem like a bad idea to be explicit.

I don't think we use round() directly, to I am hesitant to link to that,
but your idea that we should mention we are rounding to the "nearest"
integer, rather than floor or ceil is a good one, so I mentioned that in
the attached updated patch.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EnterpriseDB https://enterprisedb.com

The usefulness of a cup is in its emptiness, Bruce Lee

Attachment Content-Type Size
array.diff text/x-diff 512 bytes

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2020-08-22 16:55:34 Re: Document "59.2. Built-in Operator Classes" have a clerical error?
Previous Message David G. Johnston 2020-08-22 15:34:35 Re: Procedures