]> granicus.if.org Git - postgresql/commitdiff
Add hints to cases where indexes fail because of values that are too long.
authorBruce Momjian <bruce@momjian.us>
Wed, 10 Aug 2005 21:36:46 +0000 (21:36 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 10 Aug 2005 21:36:46 +0000 (21:36 +0000)
src/backend/access/hash/hashinsert.c
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtsort.c
src/backend/access/rtree/rtree.c

index a09b8b4bc151041381ad9f8348254fe9d6cf269f..860376cd48122d72425ba1dc839c2e289d89e481 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.36 2005/03/21 01:23:57 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.37 2005/08/10 21:36:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -88,7 +88,8 @@ _hash_doinsert(Relation rel, HashItem hitem)
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                                 errmsg("index row size %lu exceeds hash maximum %lu",
                                                (unsigned long) itemsz,
-                                               (unsigned long) HashMaxItemSize((Page) metap))));
+                                               (unsigned long) HashMaxItemSize((Page) metap)),
+                                errhint("Values larger than a buffer page cannot be indexed.")));
 
        /*
         * Compute the target bucket number, and convert to block number.
index 9b9fa44e6ed15aabc07165ec8b22e0096812c5ec..a613b6b978f6828c5f4efa5845306cabd04429b3 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.121 2005/06/06 20:22:57 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.122 2005/08/10 21:36:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -392,7 +392,10 @@ _bt_insertonpg(Relation rel,
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                                 errmsg("index row size %lu exceeds btree maximum, %lu",
                                                (unsigned long) itemsz,
-                                               (unsigned long) BTMaxItemSize(page))));
+                                               (unsigned long) BTMaxItemSize(page)),
+                                errhint("Values larger than 1/3 of a buffer page cannot be indexed\n"
+                                                "Consider a separate column containing an MD5 hash of the value\n"
+                                                "or use full text indexing.")));
 
        /*
         * Determine exactly where new item will go.
index 115708b78094a94a759656e922296708e26f195a..edad76b9f2fd7d6bfafb25055046ce6c35f18379 100644 (file)
@@ -56,7 +56,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.91 2005/06/06 20:22:57 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.92 2005/08/10 21:36:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -498,7 +498,10 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, BTItem bti)
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                                 errmsg("index row size %lu exceeds btree maximum, %lu",
                                                (unsigned long) btisz,
-                                               (unsigned long) BTMaxItemSize(npage))));
+                                               (unsigned long) BTMaxItemSize(npage)),
+                                errhint("Values larger than 1/3 of a buffer page cannot be indexed\n"
+                                                "Consider a separate column containing an MD5 hash of the value\n"
+                                                "or use full text indexing.")));
 
        if (pgspc < btisz || pgspc < state->btps_full)
        {
index e9eaa1941d6ed80b36c95c4e885f89b28a8aedcd..3b96b9ebe2d237d571f95e9ed977935e5db16500 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/access/rtree/rtree.c,v 1.90 2005/06/06 17:01:22 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/access/rtree/rtree.c,v 1.91 2005/08/10 21:36:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -733,7 +733,8 @@ rtpicksplit(Relation r,
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                                 errmsg("index row size %lu exceeds rtree maximum, %lu",
                                                (unsigned long) newitemsz,
-                                               (unsigned long) RTPageAvailSpace)));
+                                               (unsigned long) RTPageAvailSpace),
+                                errhint("Values larger than a buffer page cannot be indexed.")));
 
        maxoff = PageGetMaxOffsetNumber(page);
        newitemoff = OffsetNumberNext(maxoff);          /* phony index for new