From a35b6b6418ca265b9649c033cfe727bf85cbe026 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Sun, 10 Mar 2002 06:02:24 +0000
Subject: [PATCH] Add DEFAULT_INDEX_TYPE == "btree", for clarity.

---
 src/backend/parser/analyze.c | 5 +++--
 src/backend/parser/gram.y    | 6 ++++--
 src/include/catalog/index.h  | 3 ++-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index bb29c14699d..5fb298e1c27 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *	$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.218 2002/03/08 06:55:08 tgl Exp $
+ *	$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.219 2002/03/10 06:02:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -16,6 +16,7 @@
 #include "access/heapam.h"
 #include "catalog/catname.h"
 #include "catalog/heap.h"
+#include "catalog/index.h"
 #include "catalog/pg_index.h"
 #include "catalog/pg_type.h"
 #include "nodes/makefuncs.h"
@@ -1048,7 +1049,7 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
 			index->idxname = NULL;		/* will set it later */
 
 		index->relname = cxt->relname;
-		index->accessMethod = "btree";
+		index->accessMethod = DEFAULT_INDEX_TYPE;
 		index->indexParams = NIL;
 		index->whereClause = NULL;
 
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 978be8b58ea..ec20ce19065 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.290 2002/03/10 06:00:13 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.291 2002/03/10 06:02:23 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -51,6 +51,7 @@
 #include <ctype.h>
 
 #include "access/htup.h"
+#include "catalog/index.h"
 #include "catalog/pg_type.h"
 #include "nodes/params.h"
 #include "nodes/parsenodes.h"
@@ -2516,7 +2517,8 @@ index_opt_unique:  UNIQUE						{ $$ = TRUE; }
 		;
 
 access_method_clause:  USING access_method		{ $$ = $2; }
-		| /*EMPTY*/								{ $$ = "btree"; }
+		/* If btree changes as our default, update pg_get_indexdef() */
+		| /*EMPTY*/								{ $$ = DEFAULT_INDEX_TYPE; }
 		;
 
 index_params:  index_list						{ $$ = $1; }
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index a2d47b836d2..c31900a7ccd 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: index.h,v 1.44 2002/02/19 20:11:19 tgl Exp $
+ * $Id: index.h,v 1.45 2002/03/10 06:02:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,6 +18,7 @@
 #include "catalog/pg_index.h"
 #include "nodes/execnodes.h"
 
+#define DEFAULT_INDEX_TYPE	"btree"
 
 /* Typedef for callback function for IndexBuildHeapScan */
 typedef void (*IndexBuildCallback) (Relation index,
-- 
GitLab