BUG #14016: Incomplete documentation of IN subquery expression

Lists: pgsql-bugs
From: manlio(dot)perillo(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14016: Incomplete documentation of IN subquery expression
Date: 2016-03-11 16:39:28
Message-ID: 20160311163928.6674.94707@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14016
Logged by: Manlio Perillo
Email address: manlio(dot)perillo(at)gmail(dot)com
PostgreSQL version: 9.5.1
Operating system: Linux
Description:

At the end of the documentation for VALUE (sql-values.html), there is the
following tip:
"For simple IN tests, it's better to rely on the list-of-scalars form of IN
than to write a VALUES query as shown above"

However there is no reference to the "list-of-scalars" forms of IN, in the
functions-subquery.html page. It is only reported that the supported syntax
is "expression IN (subquery)"

The reference was available in an old version (7.3), where the manual
documented both the scalar form and sub query form:
"expression IN (value[, ...])"


From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: manlio(dot)perillo(at)gmail(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
Date: 2016-03-11 17:02:01
Message-ID: CAKFQuwYR0xCbQS=fpv50Jqnsii=Y+B5sgkzzkY_PJG6M5fR1OQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Fri, Mar 11, 2016 at 9:39 AM, <manlio(dot)perillo(at)gmail(dot)com> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 14016
> Logged by: Manlio Perillo
> Email address: manlio(dot)perillo(at)gmail(dot)com
> PostgreSQL version: 9.5.1
> Operating system: Linux
> Description:
>
> At the end of the documentation for VALUE (sql-values.html), there is the
> following tip:
> "For simple IN tests, it's better to rely on the list-of-scalars form of IN
> than to write a VALUES query as shown above"
>
> However there is no reference to the "list-of-scalars" forms of IN, in the
> functions-subquery.html page. It is only reported that the supported
> syntax
> is "expression IN (subquery)"
>
> The reference was available in an old version (7.3), where the manual
> documented both the scalar form and sub query form:
> "expression IN (value[, ...])"
>

​It was moved...


http://www.postgresql.org/docs/9.5/interactive/functions-comparisons.html#AEN20283

​The interpretation being that a "list of scalars" is, in this situation,
semantically equivalent to an array - though having the later you would
have to use "=ANY(array)" instead of "IN"

​Apparently someone disagreed with the note in the subquery section:

>>>Note: This form of IN is not truly a subquery expression, but it seems
best to document it in the same place as subquery IN.

David J.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: manlio(dot)perillo(at)gmail(dot)com, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
Date: 2016-04-26 20:27:37
Message-ID: 20160426202737.GA13058@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Fri, Mar 11, 2016 at 10:02:01AM -0700, David G. Johnston wrote:
> On Fri, Mar 11, 2016 at 9:39 AM, <manlio(dot)perillo(at)gmail(dot)com> wrote:
>
> At the end of the documentation for VALUE (sql-values.html), there is the
> following tip:
> "For simple IN tests, it's better to rely on the list-of-scalars form of IN
> than to write a VALUES query as shown above"
>
> However there is no reference to the "list-of-scalars" forms of IN, in the
> functions-subquery.html page.  It is only reported that the supported
> syntax
> is "expression IN (subquery)"
>
> The reference was available in an old version (7.3), where the manual
> documented both the scalar form and sub query form:
> "expression IN (value[, ...])"
>
>
> ​It was moved...
>
> ​http://www.postgresql.org/docs/9.5/interactive/functions-comparisons.html#
> AEN20283
>
> ​The interpretation being that a "list of scalars" is, in this situation,
> semantically equivalent to an array - though having the later you would have to
> use "=ANY(array)" instead of "IN"
>
> ​Apparently someone disagreed with the note in the subquery section:
>
> >>>Note: This form of IN is not truly a subquery expression, but it seems best
> to document it in the same place as subquery IN.

Does the attached patch improve this?

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

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

Attachment Content-Type Size
in.diff text/x-diff 1.4 KB

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Manlio Perillo <manlio(dot)perillo(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
Date: 2016-04-26 21:00:39
Message-ID: CAKFQuwaV9t0kRQPsnskF9yQ=L+P+TvDYMV+X0xnGxHz=5-XG6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tue, Apr 26, 2016 at 1:27 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> On Fri, Mar 11, 2016 at 10:02:01AM -0700, David G. Johnston wrote:
> > On Fri, Mar 11, 2016 at 9:39 AM, <manlio(dot)perillo(at)gmail(dot)com> wrote:
> >
> > At the end of the documentation for VALUE (sql-values.html), there
> is the
> > following tip:
> > "For simple IN tests, it's better to rely on the list-of-scalars
> form of IN
> > than to write a VALUES query as shown above"
> >
> > However there is no reference to the "list-of-scalars" forms of IN,
> in the
> > functions-subquery.html page. It is only reported that the supported
> > syntax
> > is "expression IN (subquery)"
> >
> > The reference was available in an old version (7.3), where the manual
> > documented both the scalar form and sub query form:
> > "expression IN (value[, ...])"
> >
> >
> > ​It was moved...
> >
> > ​
> http://www.postgresql.org/docs/9.5/interactive/functions-comparisons.html#
> > AEN20283
> >
> > ​The interpretation being that a "list of scalars" is, in this situation,
> > semantically equivalent to an array - though having the later you would
> have to
> > use "=ANY(array)" instead of "IN"
> >
> > ​Apparently someone disagreed with the note in the subquery section:
> >
> > >>>Note: This form of IN is not truly a subquery expression, but it
> seems best
> > to document it in the same place as subquery IN.
>
> Does the attached patch improve this?
>

​I'd append "scalar" to the id to distinguish in from the subquery
version. Otherwise any suggest I make seems like overkill. The main point
being the "list of scalars" is not a term we use on the referenced page,
and the chapter header indicates "Row and Array" of which this is similar
but technically neither.​

​<sect2 id="functions-comparisons-in-scalar"> [...]​

[...] rely on the ​<link
linkend="functions-comparison-in-scalar">array</link> form of [...]​

​David J.​


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Manlio Perillo <manlio(dot)perillo(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
Date: 2016-04-27 00:20:10
Message-ID: 20160427002010.GC13058@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tue, Apr 26, 2016 at 02:00:39PM -0700, David G. Johnston wrote:
> On Tue, Apr 26, 2016 at 1:27 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > >>>Note: This form of IN is not truly a subquery expression, but it seems
> best
> > to document it in the same place as subquery IN.
>
> Does the attached patch improve this?
>
>
> ​I'd append "scalar" to the id to distinguish in from the subquery version. 
> Otherwise any suggest I make seems like overkill.  The main point being the
> "list of scalars" is not a term we use on the referenced page, and the chapter
> header indicates "Row and Array" of which this is similar but technically
> neither.​
>
> ​<sect2 id="functions-comparisons-in-scalar"> [...]​
>
> [...] rely on the ​<link linkend="functions-comparison-in-scalar">array</link>
> form of [...]​

Sorry, there was already a link in that place --- I had linked to the
wrong spot. New patch attached.

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

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

Attachment Content-Type Size
in.diff text/x-diff 917 bytes

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Manlio Perillo <manlio(dot)perillo(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
Date: 2016-04-27 00:32:04
Message-ID: CAKFQuwaXptTZ4Ts1iCXwt2UOxGnBcK+uSbToEj+aTbZfos0Apg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tuesday, April 26, 2016, Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> On Tue, Apr 26, 2016 at 02:00:39PM -0700, David G. Johnston wrote:
> > On Tue, Apr 26, 2016 at 1:27 PM, Bruce Momjian <bruce(at)momjian(dot)us
> <javascript:;>> wrote:
> > > >>>Note: This form of IN is not truly a subquery expression, but
> it seems
> > best
> > > to document it in the same place as subquery IN.
> >
> > Does the attached patch improve this?
> >
> >
> > ​I'd append "scalar" to the id to distinguish in from the subquery
> version.
> > Otherwise any suggest I make seems like overkill. The main point being
> the
> > "list of scalars" is not a term we use on the referenced page, and the
> chapter
> > header indicates "Row and Array" of which this is similar but technically
> > neither.​
> >
> > ​<sect2 id="functions-comparisons-in-scalar"> [...]​
> >
> > [...] rely on the ​<link
> linkend="functions-comparison-in-scalar">array</link>
> > form of [...]​
>
> Sorry, there was already a link in that place --- I had linked to the
> wrong spot. New patch attached.
>
>
I think the spot you linked to the first time was correct. The subquery
form is the one you get when using values, the scalar version is the one
the note wants to link to.

David J.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Manlio Perillo <manlio(dot)perillo(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
Date: 2016-04-27 00:41:33
Message-ID: 20160427004133.GE13058@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tue, Apr 26, 2016 at 05:32:04PM -0700, David G. Johnston wrote:
> I think the spot you linked to the first time was correct.  The subquery form
> is the one you get when using values, the scalar version is the one the note
> wants to link to.

OK, updated patch attached.

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

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

Attachment Content-Type Size
in.diff text/x-diff 1.4 KB

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Manlio Perillo <manlio(dot)perillo(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
Date: 2016-04-27 00:45:04
Message-ID: CAKFQuwajwPSNMybkgBJgGB+69O8FUooSnFxVVQZxn_aVUD-9Aw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tuesday, April 26, 2016, Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> On Tue, Apr 26, 2016 at 05:32:04PM -0700, David G. Johnston wrote:
> > I think the spot you linked to the first time was correct. The subquery
> form
> > is the one you get when using values, the scalar version is the one the
> note
> > wants to link to.
>
> OK, updated patch attached.
>
>
Looks good. Thanks.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Manlio Perillo <manlio(dot)perillo(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
Date: 2016-06-28 20:16:22
Message-ID: 20160628201622.GB11193@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tue, Apr 26, 2016 at 08:41:33PM -0400, Bruce Momjian wrote:
> On Tue, Apr 26, 2016 at 05:32:04PM -0700, David G. Johnston wrote:
> > I think the spot you linked to the first time was correct.  The subquery form
> > is the one you get when using values, the scalar version is the one the note
> > wants to link to.
>
> OK, updated patch attached.

Patch applied.

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

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +