| From: | Bruce Momjian <bruce(at)momjian(dot)us> |
|---|---|
| To: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
| Cc: | pgsql-docs <pgsql-docs(at)postgresql(dot)org> |
| Subject: | Re: CREATE INDEX...USING |
| Date: | 2022-08-17 18:58:24 |
| Message-ID: | Yv06UMdbAdOMySoF@momjian.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-docs |
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(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com
Indecision is a decision. Inaction is an action. Mark Batterson
| Attachment | Content-Type | Size |
|---|---|---|
| using.diff | text/x-diff | 755 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2022-08-17 19:30:11 | CREATE STATISTICS and partitoins/inheritance |
| Previous Message | Jeff Janes | 2022-08-17 16:41:03 | CREATE INDEX...USING |