Re: Remove columns pg_index.haskeytype and pg_index.indisclustered - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Remove columns pg_index.haskeytype and pg_index.indisclustered
Date
Msg-id 200105150347.f4F3loA18580@candle.pha.pa.us
Whole thread Raw
In response to Re: Remove columns pg_index.haskeytype and pg_index.indisclustered  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Remove columns pg_index.haskeytype and pg_index.indisclustered
List pgsql-patches
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > I have removed pg_index.haskeytype and pg_index.indisclustered with the
> > > following patch.  They were not used.
> >
> > haskeytype IS used, by GIST.  Kindly revert this entire patch.
>
> Fixing now.  Thanks.

Patch applied.  Field re-added.   (I removed it incorrectly anyway.)

What threw me off is that there was a comment saying the field was not
used.

How does GIST set this field?  Does GIST insert directly into pg_index?
I don't see this field set anywhere except to 'true'.  Here are the
references I see from the 7.1.X code:

./backend/access/gist/gist.c:   giststate->haskeytype = itupform->indhaskeytype;
./backend/access/gist/gist.c:   if (giststate->haskeytype)
./backend/access/gist/gist.c:   if (giststate->haskeytype)
./backend/access/gist/gist.c:   if (giststate->haskeytype)
./backend/catalog/index.c:      indexForm->indhaskeytype = true;        /* not actually used anymore */
./include/access/gist.h:        bool            haskeytype;
./include/catalog/pg_index.h: * first variable length field.  so I moved indislossy, indhaskeytype,
./include/catalog/pg_index.h:   bool            indhaskeytype;  /* does key type != attribute type? */
./include/catalog/pg_index.h:#define Anum_pg_index_indhaskeytype                8

--
  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/access/gist/gist.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/gist/gist.c,v
retrieving revision 1.74
diff -c -r1.74 gist.c
*** src/backend/access/gist/gist.c    2001/05/14 21:53:16    1.74
--- src/backend/access/gist/gist.c    2001/05/15 03:36:59
***************
*** 1127,1132 ****
--- 1127,1133 ----
          elog(ERROR, "initGISTstate: index %u not found",
               RelationGetRelid(index));
      itupform = (Form_pg_index) GETSTRUCT(htup);
+     giststate->haskeytype = itupform->indhaskeytype;
      indexrelid = itupform->indexrelid;
      ReleaseSysCache(htup);

Index: src/backend/catalog/index.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/catalog/index.c,v
retrieving revision 1.148
diff -c -r1.148 index.c
*** src/backend/catalog/index.c    2001/05/15 01:12:58    1.148
--- src/backend/catalog/index.c    2001/05/15 03:37:01
***************
*** 589,594 ****
--- 589,595 ----
      indexForm->indproc = indexInfo->ii_FuncOid;
      indexForm->indisclustered = false;            /* not used */
      indexForm->indislossy = islossy;
+     indexForm->indhaskeytype = true;            /* used by GIST */
      indexForm->indisunique = indexInfo->ii_Unique;
      indexForm->indisprimary = primary;
      memcpy((char *) &indexForm->indpred, (char *) predText, predLen);
Index: src/include/catalog/catversion.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/catversion.h,v
retrieving revision 1.77
diff -c -r1.77 catversion.h
*** src/include/catalog/catversion.h    2001/05/15 01:12:59    1.77
--- src/include/catalog/catversion.h    2001/05/15 03:37:02
***************
*** 53,58 ****
   */

  /*                            yyyymmddN */
! #define CATALOG_VERSION_NO    200105144

  #endif
--- 53,58 ----
   */

  /*                            yyyymmddN */
! #define CATALOG_VERSION_NO    200105145

  #endif
Index: src/include/catalog/pg_index.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_index.h,v
retrieving revision 1.18
diff -c -r1.18 pg_index.h
*** src/include/catalog/pg_index.h    2001/05/15 01:12:59    1.18
--- src/include/catalog/pg_index.h    2001/05/15 03:37:02
***************
*** 73,79 ****
   *        compiler constants for pg_index
   * ----------------
   */
! #define Natts_pg_index                    11
  #define Anum_pg_index_indexrelid        1
  #define Anum_pg_index_indrelid            2
  #define Anum_pg_index_indproc            3
--- 73,79 ----
   *        compiler constants for pg_index
   * ----------------
   */
! #define Natts_pg_index                    12
  #define Anum_pg_index_indexrelid        1
  #define Anum_pg_index_indrelid            2
  #define Anum_pg_index_indproc            3
***************
*** 81,89 ****
  #define Anum_pg_index_indclass            5
  #define Anum_pg_index_indisclustered    6
  #define Anum_pg_index_indislossy        7
! #define Anum_pg_index_indisunique        8
! #define Anum_pg_index_indisprimary        9
! #define Anum_pg_index_indreference        10
! #define Anum_pg_index_indpred            11

  #endif     /* PG_INDEX_H */
--- 81,90 ----
  #define Anum_pg_index_indclass            5
  #define Anum_pg_index_indisclustered    6
  #define Anum_pg_index_indislossy        7
! #define Anum_pg_index_indhaskeytype        8
! #define Anum_pg_index_indisunique        9
! #define Anum_pg_index_indisprimary        10
! #define Anum_pg_index_indreference        11
! #define Anum_pg_index_indpred            12

  #endif     /* PG_INDEX_H */

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Remove columns pg_index.haskeytype and pg_index.indisclustered
Next
From: "Joe Conway"
Date:
Subject: Re: [HACKERS] contrib