From: Bruce Momjian <bruce@momjian.us>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: pgsql-docs <pgsql-docs@postgresql.org>
Subject: Re: CREATE INDEX...USING
Date: Wed, 17 Aug 2022 14:58:24 -0400
Message-ID: <Yv06UMdbAdOMySoF@momjian.us> (raw)
In-Reply-To: <CAMkU=1zhCpC7hottyMWM5Pimr9vRLprSwzLg+7PgajWhKZqRzw@mail.gmail.com>
References: <CAMkU=1zhCpC7hottyMWM5Pimr9vRLprSwzLg+7PgajWhKZqRzw@mail.gmail.com>
On Wed, Aug 17, 2022 at 12:41:03PM -0400, Jeff Janes wrote:
> This was recently added to CREATE INDEX reference page:
>
> + The optional <literal>USING</literal> clause specifies an index
> + type as described in <xref linkend="indexes-types"/>. If not
> + specified, a default index type will be used based on the
> + data types of the columns.
>
> But I think this is wrong, the default type is BTREE, it does not depend on the
> data type. Or at least, I've never witnessed the claimed behavior. The claim
> also conflicts with what is said at https://www.postgresql.org/docs/10/
> indexes-types.html
You are correct --- parser/gram.y has:
access_method_clause:
USING name { $$ = $2; }
| /*EMPTY*/ { $$ = DEFAULT_INDEX_TYPE; }
and from include/catalog/index.h:
#define DEFAULT_INDEX_TYPE "btree"
Patch attached.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Indecision is a decision. Inaction is an action. Mark Batterson
Attachments:
[text/x-diff] using.diff (754B, ../Yv06UMdbAdOMySoF@momjian.us/2-using.diff)
download | inline diff:diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgmlindex 944fdb4b09..cb4b43f637 100644--- a/doc/src/sgml/ref/create_index.sgml+++ b/doc/src/sgml/ref/create_index.sgml@@ -154,9 +154,8 @@ CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] <replaceable class=
<listitem>
<para>
The optional <literal>USING</literal> clause specifies an index
- type as described in <xref linkend="indexes-types"/>. If not- specified, a default index type will be used based on the- data types of the columns.+ type as described in <xref linkend="indexes-types"/>. The+ default is <literal>btree</literal>.
</para>
</listitem>
</varlistentry>
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, jeff.janes@gmail.com
Subject: Re: CREATE INDEX...USING
In-Reply-To: <Yv06UMdbAdOMySoF@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