Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 237be3c

Browse files
committed
Add hints to cases where indexes fail because of values that are too long.
1 parent 8bbf227 commit 237be3c

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

src/backend/access/hash/hashinsert.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.36 2005/03/21 01:23:57 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.37 2005/08/10 21:36:45 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -88,7 +88,8 @@ _hash_doinsert(Relation rel, HashItem hitem)
8888
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
8989
errmsg("index row size %lu exceeds hash maximum %lu",
9090
(unsigned long) itemsz,
91-
(unsigned long) HashMaxItemSize((Page) metap))));
91+
(unsigned long) HashMaxItemSize((Page) metap)),
92+
errhint("Values larger than a buffer page cannot be indexed.")));
9293

9394
/*
9495
* Compute the target bucket number, and convert to block number.

src/backend/access/nbtree/nbtinsert.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.121 2005/06/06 20:22:57 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.122 2005/08/10 21:36:45 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -392,7 +392,10 @@ _bt_insertonpg(Relation rel,
392392
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
393393
errmsg("index row size %lu exceeds btree maximum, %lu",
394394
(unsigned long) itemsz,
395-
(unsigned long) BTMaxItemSize(page))));
395+
(unsigned long) BTMaxItemSize(page)),
396+
errhint("Values larger than 1/3 of a buffer page cannot be indexed\n"
397+
"Consider a separate column containing an MD5 hash of the value\n"
398+
"or use full text indexing.")));
396399

397400
/*
398401
* Determine exactly where new item will go.

src/backend/access/nbtree/nbtsort.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
* Portions Copyright (c) 1994, Regents of the University of California
5757
*
5858
* IDENTIFICATION
59-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.91 2005/06/06 20:22:57 tgl Exp $
59+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.92 2005/08/10 21:36:45 momjian Exp $
6060
*
6161
*-------------------------------------------------------------------------
6262
*/
@@ -498,7 +498,10 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, BTItem bti)
498498
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
499499
errmsg("index row size %lu exceeds btree maximum, %lu",
500500
(unsigned long) btisz,
501-
(unsigned long) BTMaxItemSize(npage))));
501+
(unsigned long) BTMaxItemSize(npage)),
502+
errhint("Values larger than 1/3 of a buffer page cannot be indexed\n"
503+
"Consider a separate column containing an MD5 hash of the value\n"
504+
"or use full text indexing.")));
502505

503506
if (pgspc < btisz || pgspc < state->btps_full)
504507
{

src/backend/access/rtree/rtree.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/rtree/rtree.c,v 1.90 2005/06/06 17:01:22 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/rtree/rtree.c,v 1.91 2005/08/10 21:36:46 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -733,7 +733,8 @@ rtpicksplit(Relation r,
733733
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
734734
errmsg("index row size %lu exceeds rtree maximum, %lu",
735735
(unsigned long) newitemsz,
736-
(unsigned long) RTPageAvailSpace)));
736+
(unsigned long) RTPageAvailSpace),
737+
errhint("Values larger than a buffer page cannot be indexed.")));
737738

738739
maxoff = PageGetMaxOffsetNumber(page);
739740
newitemoff = OffsetNumberNext(maxoff); /* phony index for new

0 commit comments

Comments
 (0)