pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: sean@materialize.io
To: pgsql-docs@lists.postgresql.org
Subject: Re: Subscript expressions do not have to evaluate to integers
Date: Fri, 21 Aug 2020 20:33:31 -0400
Message-ID: <20200822003331.GN13363@momjian.us> (raw)
In-Reply-To: <159538675800.624.7728794628229799531@wrigleys.postgresql.org>
References: <159538675800.624.7728794628229799531@wrigleys.postgresql.org>

On Wed, Jul 22, 2020 at 02:59:18AM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/12/sql-expressions.html
> Description:
> 
> Section 4.2.3. Subscripts of the documentation states:
> 
> > Each subscript is itself an expression, which must yield an integer
> value.
> 
> However, the following query works on Postgres 12.1
> 
> SELECT (ARRAY[1, 2, 3]::integer[])[1.5];
> 
>  array
> -------
>      2
> 
> 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?

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

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

Attachments:

array.diff (text/x-diff, 500B) download diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml index 2f993ca2e0..4930cecd7b 100644 --- a/doc/src/sgml/syntax.sgml +++ b/doc/src/sgml/syntax.sgml @@ -1378,7 +1378,7 @@ CREATE FUNCTION dept(text) RETURNS dept </synopsis> (Here, the brackets <literal>[ ]</literal> are meant to appear literally.) Each <replaceable>subscript</replaceable> is itself an expression, - which must yield an integer value. + and will be rounded to an integer value. </para> <para>

view thread (5+ messages)  latest in thread

Message-ID: <20200822003331.GN13363@momjian.us>
Permalink:  ../20200822003331.GN13363@momjian.us/
Also on:    postgresql.org/message-id/20200822003331.GN13363@momjian.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: bruce@momjian.us, sean@materialize.io, pgsql-docs@lists.postgresql.org
  Subject: Re: Subscript expressions do not have to evaluate to integers
  In-Reply-To: <20200822003331.GN13363@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox