Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit17742a0

Browse files
committed
Fix broken error check in _hash_doinsert.
You can't just cast a HashMetaPage to a Page, because the meta pagedata is stored after the page header, not at offset 0. Fortunately,this didn't break anything because it happens to find hashm_bsizeat the offset at which it expects to find pd_pagesize_version, andthe values are close enough to the same that this works out.Still, it's a bug, so back-patch to all supported versions.Mithun Cy, revised a bit by me.
1 parent51126cc commit17742a0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎src/backend/access/hash/hashinsert.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ _hash_doinsert(Relation rel, IndexTuple itup)
3434
BlockNumberblkno;
3535
BlockNumberoldblkno=InvalidBlockNumber;
3636
boolretry= false;
37+
Pagemetapage;
3738
Pagepage;
3839
HashPageOpaquepageopaque;
3940
Sizeitemsz;
@@ -53,7 +54,8 @@ _hash_doinsert(Relation rel, IndexTuple itup)
5354

5455
/* Read the metapage */
5556
metabuf=_hash_getbuf(rel,HASH_METAPAGE,HASH_READ,LH_META_PAGE);
56-
metap=HashPageGetMeta(BufferGetPage(metabuf));
57+
metapage=BufferGetPage(metabuf);
58+
metap=HashPageGetMeta(metapage);
5759

5860
/*
5961
* Check whether the item can fit on a hash page at all. (Eventually, we
@@ -62,11 +64,11 @@ _hash_doinsert(Relation rel, IndexTuple itup)
6264
*
6365
* XXX this is useless code if we are only storing hash keys.
6466
*/
65-
if (itemsz>HashMaxItemSize((Page)metap))
67+
if (itemsz>HashMaxItemSize(metapage))
6668
ereport(ERROR,
6769
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
6870
errmsg("index row size %zu exceeds hash maximum %zu",
69-
itemsz,HashMaxItemSize((Page)metap)),
71+
itemsz,HashMaxItemSize(metapage)),
7072
errhint("Values larger than a buffer page cannot be indexed.")));
7173

7274
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp