Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mewkz-0000fo-1t for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Oct 2021 09:59:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mewkw-0004sg-59 for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Oct 2021 09:59:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mewkv-0004rv-I1 for pgsql-bugs@lists.postgresql.org; Mon, 25 Oct 2021 09:59:01 +0000 Received: from mail.hmail.be ([77.73.98.240]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1mewkp-0006sR-Rr for pgsql-bugs@lists.postgresql.org; Mon, 25 Oct 2021 09:59:00 +0000 DKIM-Signature: v=1; c=relaxed/relaxed; h=from:content-type:mime-version:subject:message-id:date:cc:to; d=verschooten.net; s=mail; a=rsa-sha256; bh=CoeJfHJUWRfN8KHr/vuaFe1uab+LCA7/XITGJq1NfdM=; b=e4zDvm20T1s9MOZpZOZgZvqhDOYFkXV1m4mziWMkj0JXEx6OOXetS3mjmsw/Dj7jC GgeUjApSdRAf+CKpmfh1hcbAVa5JyDswt4gGnVlvPX/NRUfuMucdNT4XG04aR87SO+w qySJz7Kiwx1UiSIboharc0kMNWTpXROj1obao7U=; Received: from smtpclient.apple ([2a02:1807:3930:100:c5e6:41a4:9439:92b8]) by hmail.be with MailEnable ESMTPSA (version=TLS1_2 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256); Mon, 25 Oct 2021 11:58:51 +0200 From: Herman verschooten Content-Type: multipart/alternative; boundary="Apple-Mail=_70A155AE-D08B-4382-ABC3-D34955328F42" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: ERROR: posting list tuple with 20 items cannot be split at offset 168 Message-Id: <8CDB73C1-E3AF-40A6-BA81-8AFE174C6402@verschooten.net> Date: Mon, 25 Oct 2021 11:58:48 +0200 Cc: Christl Nagels To: pgsql-bugs@lists.postgresql.org X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Envelope-Sender: Herman@verschooten.net X-ME-Bayesian: 0.000000 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_70A155AE-D08B-4382-ABC3-D34955328F42 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, I upgraded postgres 13 to 14+231.pgdg18.04+1 during the weekend, virtual = ubuntu 20.04.3. this morning a user reported an error when trying to change a flag in = our web app (Phoenix, ecto). I traced it back to an index issue on a boolean column. This is the table: tranman_production=3D# \d freights Table "public.freights" Column | Type | Collation | Nullable | = Default = --------------+-----------------------------+-----------+----------+------= -------------------------------- id | integer | | not null | = nextval('freights_id_seq'::regclass) order_id | integer | | | product_id | integer | | | amount | integer | | | reference_1 | character varying | | | reference_2 | character varying | | | reference_3 | character varying | | | reference_4 | character varying | | | status | integer | | | 0 created_at | timestamp without time zone | | not null | updated_at | timestamp without time zone | | not null | cmr | bigint | | | amount_out | integer | | not null | 0 paused | boolean | | | = false cmr_received | boolean | | | = false Indexes: "freights_pkey" PRIMARY KEY, btree (id) "index_freights_on_cmr" btree (cmr) "index_freights_on_cmr_received" btree (cmr_received) "index_freights_on_order_id" btree (order_id) "index_freights_on_product_id" btree (product_id) "index_freights_on_reference_1" btree (reference_1) "index_freights_on_reference_2" btree (reference_2) "index_freights_on_reference_3" btree (reference_3) "index_freights_on_reference_4" btree (reference_4) "index_freights_on_status" btree (status) Foreign-key constraints: "fk_rails_21fdf332ee" FOREIGN KEY (product_id) REFERENCES = products(id) "fk_rails_af9f7b0831" FOREIGN KEY (order_id) REFERENCES orders(id) Referenced by: TABLE "freight_docs" CONSTRAINT "fk_rails_10448cfa4f" FOREIGN KEY = (freight_id) REFERENCES freights(id) TABLE "freight_events" CONSTRAINT "fk_rails_20c83ae774" FOREIGN KEY = (freight_id) REFERENCES freights(id) TABLE "rides" CONSTRAINT "fk_rails_a50483d9c3" FOREIGN KEY = (freight_id) REFERENCES freights(id) And this is what happens: tranman_production=3D# update freights set cmr_received=3Dfalse where = id=3D49632; ERROR: XX000: posting list tuple with 20 items cannot be split at = offset 168 LOCATION: _bt_swap_posting, nbtdedup.c:1037 If I drop the index index_freights_on_cmr_received, then the update = succeeds. If I recreate the index, the error resurfaces. Note that it does not happen for every row in the database. Sincerely, Herman verschooten --Apple-Mail=_70A155AE-D08B-4382-ABC3-D34955328F42 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Hi,

I = upgraded postgres 13 to 14+231.pgdg18.04+1 during the weekend, = virtual ubuntu 20.04.3.

this morning a user reported an error when trying to change a = flag in our web app (Phoenix, ecto).
I traced it = back to an index issue on a boolean column.

This is the table:

tranman_production=3D# \d = freights
                =                     =      Table "public.freights"
    Column   =  |            Type     =         | Collation | Nullable |     =           Default
--------------+-----------------------------+-----------+------= ----+--------------------------------------
 id     =       | integer             =         |           | not = null | nextval('freights_id_seq'::regclass)
 order_id   =   | integer                 =     |           |     =      |
 product_id   | integer         =             |         =   |          |
 amount     =   | integer                 =     |           |     =      |
 reference_1  | character varying     =       |           |   =        |
 reference_2  | character varying =           |           = |          |
 reference_3  | character varying =           |           = |          |
 reference_4  | character varying =           |           = |          |
 status       | integer =                     | =           |          | = 0
 created_at   | timestamp without time zone | =           | not null |
 updated_at   | = timestamp without time zone |           | not = null |
 cmr          | bigint   =                    | =           |         =  |
 amount_out   | integer         =             |         =   | not null | 0
 paused       | boolean     =                 |     =       |          | = false
 cmr_received | boolean         =             |         =   |          | false
Indexes:
    = "freights_pkey" PRIMARY KEY, btree (id)
    "index_freights_on_cmr" btree = (cmr)
 =   "index_freights_on_cmr_received" btree = (cmr_received)
    "index_freights_on_order_id" btree = (order_id)
    "index_freights_on_product_id" btree = (product_id)
    "index_freights_on_reference_1" btree = (reference_1)
    "index_freights_on_reference_2" btree = (reference_2)
    "index_freights_on_reference_3" btree = (reference_3)
    "index_freights_on_reference_4" btree = (reference_4)
    "index_freights_on_status" btree = (status)
Foreign-key constraints:
    "fk_rails_21fdf332ee" FOREIGN = KEY (product_id) REFERENCES products(id)
    "fk_rails_af9f7b0831" FOREIGN = KEY (order_id) REFERENCES orders(id)
Referenced by:
    TABLE = "freight_docs" CONSTRAINT "fk_rails_10448cfa4f" FOREIGN KEY (freight_id) = REFERENCES freights(id)
    TABLE "freight_events" CONSTRAINT = "fk_rails_20c83ae774" FOREIGN KEY (freight_id) REFERENCES = freights(id)
    TABLE "rides" CONSTRAINT "fk_rails_a50483d9c3" = FOREIGN KEY (freight_id) REFERENCES freights(id)

And this is what = happens:

tranman_production=3D# = update freights set cmr_received=3Dfalse where = id=3D49632;
ERROR:  XX000: posting list tuple with 20 items cannot = be split at offset 168
LOCATION:  _bt_swap_posting, = nbtdedup.c:1037

If I drop the index = index_freights_on_cmr_received, then the update succeeds.

If I recreate the index, = the error resurfaces.

Note that it does not happen for every row in the = database.

Sincerely,

Herman verschooten

= --Apple-Mail=_70A155AE-D08B-4382-ABC3-D34955328F42--