Index USING in pg_dump - Mailing list pgsql-hackers

From Bruce Momjian
Subject Index USING in pg_dump
Date
Msg-id 200203080451.g284pqT02419@candle.pha.pa.us
Whole thread Raw
Responses Re: Index USING in pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
The following patch supresses "USING btree" for btree indexes in
pg_dump:

    CREATE INDEX ii ON test (x);

    CREATE INDEX kkas ON test USING hash (x);

This is possible because btree is the default.  TODO item is:

    * Remove USING clause from pg_get_indexdef() if index is btree (Bruce)

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.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/utils/adt/ruleutils.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v
retrieving revision 1.92
diff -c -r1.92 ruleutils.c
*** src/backend/utils/adt/ruleutils.c    6 Mar 2002 19:58:26 -0000    1.92
--- src/backend/utils/adt/ruleutils.c    8 Mar 2002 04:45:51 -0000
***************
*** 395,405 ****
       * Start the index definition
       */
      initStringInfo(&buf);
!     appendStringInfo(&buf, "CREATE %sINDEX %s ON %s USING %s (",
                       idxrec->indisunique ? "UNIQUE " : "",
                       quote_identifier(NameStr(idxrelrec->relname)),
!                      quote_identifier(NameStr(indrelrec->relname)),
                       quote_identifier(NameStr(amrec->amname)));

      /*
       * Collect the indexed attributes in keybuf
--- 395,410 ----
       * Start the index definition
       */
      initStringInfo(&buf);
!     appendStringInfo(&buf, "CREATE %sINDEX %s ON %s ",
                       idxrec->indisunique ? "UNIQUE " : "",
                       quote_identifier(NameStr(idxrelrec->relname)),
!                      quote_identifier(NameStr(indrelrec->relname)));
!
!     if (strcmp(NameStr(amrec->amname), "btree") != 0)
!         appendStringInfo(&buf, "USING %s ",
                       quote_identifier(NameStr(amrec->amname)));
+
+     appendStringInfo(&buf, "(");

      /*
       * Collect the indexed attributes in keybuf

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Char selectivity
Next
From: Tom Lane
Date:
Subject: Re: Patch for removal of RULE bracket use