Re: BUG #19634: Hash partition with large MODULUS causes "invalid memory alloc request size"

From: Andres Freund <andres(at)anarazel(dot)de>
To: Pierre Forstmann <pierre(dot)forstmann(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, hackerzheng666(at)gmail(dot)com
Subject: Re: BUG #19634: Hash partition with large MODULUS causes "invalid memory alloc request size"
Date: 2026-08-21 12:24:04
Message-ID: l6smfkykhdcqqfsrja24owbu2yjo7le2mcm7qpruxu4xn7sf3s@vv3wf7ruzlxk
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2026-08-21 14:04:09 +0200, Pierre Forstmann wrote:
> I propose following patch that adds the check to new_partition_bound
> routine:
>
> postgres=# CREATE TABLE t (id int) PARTITION BY HASH (id);
> CREATE TABLE
> postgres=# CREATE TABLE t_p0 PARTITION OF t FOR VALUES WITH (MODULUS
> 268435457,
> REMAINDER 0);
> ERROR:  hash partitions bounds are too large
> DETAIL:  Creating hash partitions for modulus 268435457 would require too
> much memory.
> HINT:  Reduce the number of partitions.
> postgres=#

I am not sure it's worth doing *anything* here. There's at most a slightly
suboptimal error message here. There are many many ways to get those. Nobody
sane would create a setup like this unless they're explicitly trying to find
unexpected errors or such.

Greetings,

Andres Freund

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Melanie Plageman 2026-08-21 13:48:55 Re: MERGE/SPLIT PARTITIONS issues/questions
Previous Message Peter Eisentraut 2026-08-21 12:16:04 Re: BUG #19630: FOR PORTION OF crashes with XX000 when target range is NULL