Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOOFP-0006zp-7u for pgsql-docs@arkaria.postgresql.org; Wed, 17 Aug 2022 18:58:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oOOFN-0000uO-2g for pgsql-docs@arkaria.postgresql.org; Wed, 17 Aug 2022 18:58:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOOFM-0000uF-RJ for pgsql-docs@lists.postgresql.org; Wed, 17 Aug 2022 18:58:32 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOOFG-0007Iz-C7 for pgsql-docs@postgresql.org; Wed, 17 Aug 2022 18:58:31 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1oOOFE-001Uts-MC; Wed, 17 Aug 2022 14:58:24 -0400 Date: Wed, 17 Aug 2022 14:58:24 -0400 From: Bruce Momjian To: Jeff Janes Cc: pgsql-docs Subject: Re: CREATE INDEX...USING Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="NLEqLIs9W2g8LdEX" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --NLEqLIs9W2g8LdEX Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Wed, Aug 17, 2022 at 12:41:03PM -0400, Jeff Janes wrote: > This was recently added to CREATE INDEX reference page: > > +        The optional USING clause specifies an index > +        type as described in .  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 https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson --NLEqLIs9W2g8LdEX Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="using.diff" diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgml index 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 ] The optional USING clause specifies an index - type as described in . If not - specified, a default index type will be used based on the - data types of the columns. + type as described in . The + default is btree. --NLEqLIs9W2g8LdEX--