Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xSv9T-00000002F4h-2wwQ for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Nov 2026 11:45:35 +0000 Received: from localhost ([127.0.0.1]:48332 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xSv9S-00000000skH-2fqg for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Nov 2026 11:45:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:42478) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xSSAu-0000000Eoiv-2Y40 for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 04:49:08 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xSSAr-000000017BH-2kfr for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 04:49:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=X2lrJUfhoXnnVVhKn9mKzQW1DcWKoFv2i9F/NX9KoBU=; b=Fpd9yzxo3T2CkUWhw8ZEXEWAQn qhKCs/3z9T35J9NBbQ0RqlBgyGqkE88NHpM6nfDvts0XrYs6V411PAudh8f6B4RH5W+745XbAYqiZ 0xPjJ7ofaa7ByCW8HrIOxgx8+QtTv//FaPIEmkr22MGMmVbtNqT0Ru+iyVFkmrBh1JnoROCo6ExEf x55l7e1WIgPBEjHK7U/JggQlLmA5UQ622b6i1K73tvPAAIz6HYt9HhFhOoOS+bwLwuHfcO49QXiBX V1UTBrgMqAiQtPN2er6XrkDdgrbyes80vpXCzslI4ST6xI/9tB5i7hdfXZVWQzyayUo2Yl5msz9WW lP43O3sA==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xSSAq-00000002nTX-0Ife for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 04:49:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xSSAp-00000006xoY-1L7h for pgsql-bugs@lists.postgresql.org; Sun, 15 Nov 2026 04:49:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19904: pg_column_is_updatable(): "negative bitmapset member not allowed" for large attnum (int16 overflow) To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: hackerzheng666@gmail.com Reply-To: hackerzheng666@gmail.com, pgsql-bugs@lists.postgresql.org Date: Sun, 15 Nov 2026 04:48:38 +0000 Message-ID: <19904-57a44a8aa7638ae4@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19904 Logged by: Zheng Hacker Email address: hackerzheng666@gmail.com PostgreSQL version: 19rc2 Operating system: Linux x86_64 (Ubuntu 22.04) Description: =20 Tested on git master (20devel, commit 70c4a57b64d3; the code in question is unchanged at master 81b2179 as of 2026-11-14). Not tested on 19rc2 or older branches; the version selected in the form is only the closest listed one. create table tt(a int, b text); select pg_column_is_updatable('tt'::regclass, 32767::smallint, true); ERROR: negative bitmapset member not allowed In src/backend/utils/adt/misc.c, pg_column_is_updatable() computes AttrNumber col =3D attnum - FirstLowInvalidHeapAttributeNumber; AttrNumber is int16, FirstLowInvalidHeapAttributeNumber is -7, so for attnum >=3D 32761 the result wraps to a negative value and bms_make_singleton(col) raises the internal error. A valid table with a nonexistent column number should simply return false, not an internal error. Computing col as int (or returning false when attnum exceeds the relation's column count before building the bitmapset) avoids it.