Re: Index USING in pg_dump

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Neil Conway <nconway(at)klamath(dot)dyndns(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Index USING in pg_dump
Date: 2002-03-10 06:01:37
Message-ID: 200203100601.g2A61bf18862@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


OK, there was a tie in votes of whether we should remove "USING btree"
from pg_dump, so it isn't worth changing it. I will apply the following
patch that adds DEFAULT_INDEX_TYPE so things are clearer.

---------------------------------------------------------------------------

Bruce Momjian wrote:
> Neil Conway wrote:
> > On Fri, Mar 08, 2002 at 11:07:57AM -0500, Bruce Momjian wrote:
> > > Tom Lane wrote:
> > > > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > > > This is possible because btree is the default. TODO item is:
> > > > > * Remove USING clause from pg_get_indexdef() if index is btree (Bruce)
> > > >
> > > > I do not think this is necessary or helpful. The only possible
> > > > reason to change it would be if we thought btree might someday
> > > > not be the default index type --- but no such change is on the
> > > > horizon. And if one was, you've just embedded special knowledge
> > > > about btree in yet one more place...
> > >
> > > Yes, but it doesn't look like the way they created it.
> >
> > Why is this relevant?
> >
> > > Very few use
> > > USING in there queries. Why show it in pg_dump output?
> >
> > I agree with Tom: this seems like a waste of time, and may even be worse
> > than the current pg_dump output. The type of the index is "btree"; by
> > assuming that Pg happens to default to "btree", you're just making the
> > process of index restoration more fragile.
>
> OK, how about this patch? It just creates a macro so btree is a clear
> default. It no longer affects pg_dump.
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026

> Index: src/backend/parser/analyze.c
> ===================================================================
> RCS file: /cvsroot/pgsql/src/backend/parser/analyze.c,v
> retrieving revision 1.217
> diff -c -r1.217 analyze.c
> *** src/backend/parser/analyze.c 6 Mar 2002 06:09:51 -0000 1.217
> --- src/backend/parser/analyze.c 8 Mar 2002 16:25:59 -0000
> ***************
> *** 16,21 ****
> --- 16,22 ----
> #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"
> ***************
> *** 1049,1055 ****
> index->idxname = NULL; /* will set it later */
>
> index->relname = cxt->relname;
> ! index->accessMethod = "btree";
> index->indexParams = NIL;
> index->whereClause = NULL;
>
> --- 1050,1056 ----
> index->idxname = NULL; /* will set it later */
>
> index->relname = cxt->relname;
> ! index->accessMethod = DEFAULT_INDEX_TYPE;
> index->indexParams = NIL;
> index->whereClause = NULL;
>
> Index: src/backend/parser/gram.y
> ===================================================================
> RCS file: /cvsroot/pgsql/src/backend/parser/gram.y,v
> retrieving revision 2.287
> diff -c -r2.287 gram.y
> *** src/backend/parser/gram.y 7 Mar 2002 16:35:35 -0000 2.287
> --- src/backend/parser/gram.y 8 Mar 2002 16:26:03 -0000
> ***************
> *** 51,56 ****
> --- 51,57 ----
> #include <ctype.h>
>
> #include "access/htup.h"
> + #include "catalog/index.h"
> #include "catalog/pg_type.h"
> #include "nodes/params.h"
> #include "nodes/parsenodes.h"
> ***************
> *** 2539,2545 ****
> ;
>
> access_method_clause: USING access_method { $$ = $2; }
> ! | /*EMPTY*/ { $$ = "btree"; }
> ;
>
> index_params: index_list { $$ = $1; }
> --- 2540,2547 ----
> ;
>
> access_method_clause: USING access_method { $$ = $2; }
> ! /* If btree changes as our default, update pg_get_indexdef() */
> ! | /*EMPTY*/ { $$ = DEFAULT_INDEX_TYPE; }
> ;
>
> index_params: index_list { $$ = $1; }
> Index: src/include/catalog/index.h
> ===================================================================
> RCS file: /cvsroot/pgsql/src/include/catalog/index.h,v
> retrieving revision 1.44
> diff -c -r1.44 index.h
> *** src/include/catalog/index.h 19 Feb 2002 20:11:19 -0000 1.44
> --- src/include/catalog/index.h 8 Mar 2002 16:26:12 -0000
> ***************
> *** 18,23 ****
> --- 18,24 ----
> #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,

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-03-10 06:20:13 Allowing usernames in pg_hba.conf
Previous Message Masaru Sugawara 2002-03-10 05:43:14 Re: Adding qualification conditions to EXPLAIN output

Browse pgsql-patches by date

  From Date Subject
Next Message Zhenbang Wei 2002-03-10 06:39:48 Update pg_dump-zh_TW.po
Previous Message Thomas Lockhart 2002-03-10 00:28:51 Re: [PATCHES] Small fix for _equalValue()