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

Commit097e414

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 parent2f802d9 commit097e414

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
@@ -35,6 +35,7 @@ _hash_doinsert(Relation rel, IndexTuple itup)
3535
BlockNumberblkno;
3636
BlockNumberoldblkno;
3737
boolretry;
38+
Pagemetapage;
3839
Pagepage;
3940
HashPageOpaquepageopaque;
4041
Sizeitemsz;
@@ -58,7 +59,8 @@ _hash_doinsert(Relation rel, IndexTuple itup)
5859
restart_insert:
5960
/* Read the metapage */
6061
metabuf=_hash_getbuf(rel,HASH_METAPAGE,HASH_READ,LH_META_PAGE);
61-
metap=HashPageGetMeta(BufferGetPage(metabuf));
62+
metapage=BufferGetPage(metabuf);
63+
metap=HashPageGetMeta(metapage);
6264

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

7779
oldblkno=InvalidBlockNumber;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp