| From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
|---|---|
| To: | hackerzheng666(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19904: pg_column_is_updatable(): "negative bitmapset member not allowed" for large attnum (int16 overflow) |
| Date: | 2026-11-17 03:55:15 |
| Message-ID: | CAApHDvrxhOP5gX-f7mgpJHFhzYPE9iurd5Q2FhCYHoPg2cZ2yA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Tue, 17 Nov 2026 at 00:45, PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
> create table tt(a int, b text);
> select pg_column_is_updatable('tt'::regclass, 32767::smallint, true);
> ERROR: negative bitmapset member not allowed
So don't do that?
We could fix by just promoting the AttrNumber to int with:
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -639,7 +639,7 @@ pg_column_is_updatable(PG_FUNCTION_ARGS)
{
Oid reloid = PG_GETARG_OID(0);
AttrNumber attnum = PG_GETARG_INT16(1);
- AttrNumber col = attnum - FirstLowInvalidHeapAttributeNumber;
+ int col = attnum -
FirstLowInvalidHeapAttributeNumber;
bool include_triggers = PG_GETARG_BOOL(2);
That avoids overflowing the int16 when subtracting the -7
David
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Raja Sai pranav | 2026-11-17 04:17:06 | Re: BUG #19776: pg_combinebackup ignores the truncation_block_length of an intermediate incremental backup |
| Previous Message | shihao zhong | 2026-11-17 02:20:34 | Re: BUG #19858: pg_dump --clean --if-exists fails on NOT VALID domain constraint |