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.96) (envelope-from ) id 1wXyYn-003b5i-3C for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2026 09:52:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXyYm-001dbE-32 for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2026 09:52:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wXyYm-001db6-1z for pgsql-hackers@lists.postgresql.org; Fri, 12 Jun 2026 09:52:20 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wXyYk-00000002hi7-0Wb2 for pgsql-hackers@lists.postgresql.org; Fri, 12 Jun 2026 09:52:20 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4905529b933so7743595e9.0 for ; Fri, 12 Jun 2026 02:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1781257937; x=1781862737; darn=lists.postgresql.org; h=message-id:date:content-id:mime-version:comments:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cjztziG4qQnLu5gUfxjCy6k+yeI8XvWbkVrBIntdS+I=; b=RdmDgkfpQMvwt6ZFla86NEkgbdY26nMZpJ3QWnAccI3aEYCM/it0pd3tYLNkxqCcyY WgumPFpT/XnTE/oVI2H+Ip+n/iQOu20wxHubSVeADk4T/U1j5c+fIS2T6Fgy88oGnfcV iViN4QU98yGuf/qlXXbCYuCYMbzvPqG24aT7PuvuEII/VTp/o/nm42E6rPsZX4q83Ifz r2/uSecEzYxFVyQipW4m6YDPfqRYS0GQ4fkM0KSa7dzarraV1sF/t+IzzDLMVZ8aiJaf sNEOO1aR+q1i1TmP2B3A+jj8aKp3OVt8yW+t6LFBNi4vGlx/O3CIuxkUxcFvM/dBtack Zq2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781257937; x=1781862737; h=message-id:date:content-id:mime-version:comments:references :in-reply-to:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=cjztziG4qQnLu5gUfxjCy6k+yeI8XvWbkVrBIntdS+I=; b=jm7oHW+s02ZHsA4kuPEAgJsawyG9XbBDHjR+e/0p+R3wSb5cLUHzupdx2AfQ5kA7zw uTxJtICS+Od8DrqNu5nY1b69CHTSJmYC/SzZAOej22r+Wt+KJWCdiVJwJLf8QdveYZF/ mrPi8ZJtRHfH8ZsBPNYYVgkGR0QOe2VVHK+ao3Fy0FOcDQGM7lrYNCStOvIF+9VjnuHl 2QMo3x9uAFvLcEeUJVTeNiybzImU+tieegSoTD3VqpvuhJb/mPHC6mQpM7Xx3UfCdJg3 CS5NBzB+ezV+FhWXEMP1lkDPf1ra5fBQ9SREeKsosMo4aigCVrXcFmzKYy/qkGCpKTs/ ZLdw== X-Gm-Message-State: AOJu0Yz1zQgRJcQu5Z445UGWL5zNl3+6Ghno5f5awyNQl1ME8e7y2jpt 5V3FxzQzTEihhoOIvQrOtW0adQbhdCAj3uTDXkOufhGdoaOLkeoBknayzjD9hkw5NSY= X-Gm-Gg: Acq92OEl96BBn+MIk6OmCdZEGfvNDNeY3IYHZdKNzWUOE8v8qyW4+CwYLvBUf8UqruH MltGxdiyIjOBsOp72/JrMPUnbdZ0Euz0rqHDZr0TKmcDD6bDRT4Pufr7GpzmwvKpH8eZ3Yxat4C YpTqMzPohKdqq2gInLVSAyuluRTA+afC6U3gLoIV/jsOQv2i5MpyArKr4FbP3ppCFoipyUSKNfp 0GGGU5DWmG0eaY06uckbDxQJyoQFV/wWPAZMssO1gTSx79x9Jzxpzyqe89VNIl3F7z0qhSPD+qX XMGDtz1RqJbGPCLS2kGeadsbKf5Rn3KEfKynWMQKAAB3IDJprP67sIgw3JVgu3KK9e9UFN6Szpr lMj7PrI/CimTOeHtOdh36hRw+e22b4UjMlJcUT5R49KxY2JqdrDuJHewtMv6+kpAa3k26QUePrw o8XvtOPWU9dEEcbSqSeuigygqVXVsCag+PXmn3 X-Received: by 2002:a05:600c:c107:b0:490:c2a3:1782 with SMTP id 5b1f17b1804b1-490ec50ad27mr28098845e9.35.1781257933813; Fri, 12 Jun 2026 02:52:13 -0700 (PDT) Received: from localhost (109-81-168-148.rct.o2.cz. [109.81.168.148]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4606f2b0d28sm4433350f8f.20.2026.06.12.02.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2026 02:52:13 -0700 (PDT) From: Antonin Houska To: Ewan Young cc: PostgreSQL Hackers , mihailnikalayeu@gmail.com, alvherre@kurilemu.de Subject: Re: REPACK CONCURRENTLY fails on tables with generated columns In-reply-to: References: Comments: In-reply-to Ewan Young message dated "Fri, 12 Jun 2026 16:39:54 +0800." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3327.1781257932.1@localhost> Date: Fri, 12 Jun 2026 11:52:12 +0200 Message-ID: <3328.1781257932@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ewan Young 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