Ilegal type cast in _hash_doinsert()

From: Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Ilegal type cast in _hash_doinsert()
Date: 2016-12-22 07:04:49
Message-ID: CAD__OujahZkBC89v=KoYp3n72Gb4SGJMoYj83S7OTWEv2OUO+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

There seems to be some base bug in _hash_doinsert().
+ * XXX this is useless code if we are only storing hash keys.

+ */

+ if (itemsz > HashMaxItemSize((Page) metap))

+ ereport(ERROR,

+ (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),

+ errmsg("index row size %zu exceeds hash maximum %zu",

+ itemsz, HashMaxItemSize((Page) metap)),

+ errhint("Values larger than a buffer page cannot be
indexed.")));

"metap" (HashMetaPage) is not a Page (they the entirely different
structure), so above casting is not legal. Added a patch to correct same by
passing actual Page which stores "HashMetaPage".

--
Thanks and Regards
Mithun C Y
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
hash_doinsert_illegal_cast_01.patch application/octet-stream 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 2016-12-22 07:37:18 Re: [bug fix] Trivial ecpg bug which can cause memory overrun
Previous Message Kyotaro HORIGUCHI 2016-12-22 07:02:23 Re: BUG: pg_stat_statements query normalization issues with combined queries