pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herman verschooten <Herman@verschooten.net>
To: pgsql-bugs@lists.postgresql.org
Cc: Christl Nagels <christel.nagels@tranna.be>
Subject: ERROR:  posting list tuple with 20 items cannot be split at offset 168
Date: Mon, 25 Oct 2021 11:58:48 +0200
Message-ID: <8CDB73C1-E3AF-40A6-BA81-8AFE174C6402@verschooten.net> (raw)

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=# \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=# update freights set cmr_received=false where id=49632;
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

view thread (10+ messages)  latest in thread

Message-ID: <8CDB73C1-E3AF-40A6-BA81-8AFE174C6402@verschooten.net>
Permalink:  ../8CDB73C1-E3AF-40A6-BA81-8AFE174C6402@verschooten.net/
Also on:    postgresql.org/message-id/8CDB73C1-E3AF-40A6-BA81-8AFE174C6402@verschooten.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: Herman@verschooten.net, christel.nagels@tranna.be
  Subject: Re: ERROR:  posting list tuple with 20 items cannot be split at offset 168
  In-Reply-To: <8CDB73C1-E3AF-40A6-BA81-8AFE174C6402@verschooten.net>
  References: <8CDB73C1-E3AF-40A6-BA81-8AFE174C6402@verschooten.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox