agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Antonin Houska <ah@cybertec.at>
To: Ewan Young <kdbase.hack@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: mihailnikalayeu@gmail.com
Cc: alvherre@kurilemu.de
Subject: Re: REPACK CONCURRENTLY fails on tables with generated columns
Date: Fri, 12 Jun 2026 11:52:12 +0200
Message-ID: <3328.1781257932@localhost> (raw)
In-Reply-To: <CAON2xHMrELwx9vKg6niSf8fMBA=-MGXmG=MPQU6+vMVhGjF8kQ@mail.gmail.com>
References: <CAON2xHMrELwx9vKg6niSf8fMBA=-MGXmG=MPQU6+vMVhGjF8kQ@mail.gmail.com>
Ewan Young <kdbase.hack@gmail.com> wrote:
> REPACK (CONCURRENTLY) aborts with an internal error on any table that has
> a STORED generated column, if a concurrent UPDATE that requires index
> maintenance is applied during the catch-up phase:
>
> ERROR: no generation expression found for column number 3 of table
> "pg_temp_16396"
> Plain (non-concurrent) REPACK on such a table works fine, and so does
> REPACK (CONCURRENTLY) as long as no qualifying concurrent change is
> applied -- so the problem is specific to the concurrent-change apply path.
Thanks for the report!
> The attached patch adds an isolation test, but here is the manual
> sequence (server built with --enable-injection-points):
>
> CREATE EXTENSION injection_points;
> CREATE TABLE t (i int PRIMARY KEY, v int,
> g int GENERATED ALWAYS AS (v * 10) STORED);
> CREATE INDEX ON t (v); -- makes UPDATE of v non-HOT
> INSERT INTO t(i, v) VALUES (1, 1);
>
> -- session 1:
> SELECT injection_points_attach('repack-concurrently-before-lock', 'wait');
> REPACK (CONCURRENTLY) t; -- blocks at the injection point
>
> -- session 2, once session 1 is waiting:
> UPDATE t SET v = v + 1 WHERE i = 1;
> SELECT injection_points_wakeup('repack-concurrently-before-lock');
>
> -- session 1 then fails with the ERROR above.
I confirm I can reproduce it. I'll post a fix next week.
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
view thread (14+ messages) latest in thread
Message-ID: <3328.1781257932@localhost>
Permalink: ../3328.1781257932@localhost/
Also on: postgresql.org/message-id/3328.1781257932@localhost
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: ah@cybertec.at, kdbase.hack@gmail.com, pgsql-hackers@lists.postgresql.org, mihailnikalayeu@gmail.com, alvherre@kurilemu.de
Subject: Re: REPACK CONCURRENTLY fails on tables with generated columns
In-Reply-To: <3328.1781257932@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox