From: Bruce Momjian <bruce@momjian.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: manlio.perillo@gmail.com, "pgsql-bugs@postgresql.org" <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
Date: Tue, 26 Apr 2016 16:27:37 -0400
Message-ID: <20160426202737.GA13058@momjian.us> (raw)
In-Reply-To: <CAKFQuwYR0xCbQS=fpv50Jqnsii=Y+B5sgkzzkY_PJG6M5fR1OQ@mail.gmail.com>
References: <20160311163928.6674.94707@wrigleys.postgresql.org>
<CAKFQuwYR0xCbQS=fpv50Jqnsii=Y+B5sgkzzkY_PJG6M5fR1OQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.perillo@gmail.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@momjian.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 +
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugsAttachments:in.diff (text/x-diff, 1.4K) downloaddiff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgmlnew file mode 100644index eb2a0c5..bef458a
*** a/doc/src/sgml/func.sgml
--- b/doc/src/sgml/func.sgml
*************** WHERE EXISTS (SELECT 1 FROM tab2 WHERE c
*** 14590,14596 ****
Boolean (true/false) results.
</para>
! <sect2>
<title><literal>IN</literal></title>
<synopsis>
--- 14590,14596 ----
Boolean (true/false) results.
</para>
! <sect2 id="functions-comparisons-in">
<title><literal>IN</literal></title>
<synopsis>
diff --git a/doc/src/sgml/ref/values.sgml b/doc/src/sgml/ref/values.sgmlnew file mode 100644index 0fb3cd7..b992ce3
*** a/doc/src/sgml/ref/values.sgml
--- b/doc/src/sgml/ref/values.sgml
*************** WHERE ip_address IN (VALUES('192.168.0.1
*** 219,225 ****
<tip>
<para>
For simple <literal>IN</> tests, it's better to rely on the
! list-of-scalars form of <literal>IN</> than to write a <command>VALUES</>
query as shown above. The list of scalars method requires less writing
and is often more efficient.
</para>
--- 219,226 ----
<tip>
<para>
For simple <literal>IN</> tests, it's better to rely on the
! <link linkend="functions-comparisons-in">list-of-scalars</link> form
! of <literal>IN</> than to write a <command>VALUES</>
query as shown above. The list of scalars method requires less writing
and is often more efficient.
</para>
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: bruce@momjian.us, david.g.johnston@gmail.com
Subject: Re: BUG #14016: Incomplete documentation of IN subquery expression
In-Reply-To: <20160426202737.GA13058@momjian.us>
References: <20160311163928.6674.94707@wrigleys.postgresql.org> <CAKFQuwYR0xCbQS=fpv50Jqnsii=Y+B5sgkzzkY_PJG6M5fR1OQ@mail.gmail.com> <20160426202737.GA13058@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