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 1xCy1V-00000000EwW-0oti for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Oct 2026 11:35:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xCy1S-000000025CK-3ydP for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Oct 2026 11:35:22 +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.98.2) (envelope-from ) id 1xCy1R-000000025CC-3jZl for pgsql-hackers@lists.postgresql.org; Sat, 03 Oct 2026 11:35:22 +0000 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xCy1O-00000000BMf-3JRJ for pgsql-hackers@lists.postgresql.org; Sat, 03 Oct 2026 11:35:21 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 92EF1EC0420 for ; Sat, 3 Oct 2026 07:35:16 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Sat, 03 Oct 2026 07:35:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm3; t=1791027316; x= 1791113716; bh=nvvMnStxrImNG+rzjQ3foIIgDk2Rb58zKUv/luq+CAQ=; b=l RnoyIMiTGhbZdfRv53uORnL6zKMgNcplHAd8jx+o+JEuhFoNI0FFTueZKBiCQpZW iKNJZuNNBJGC77ke3xzcXJurohtOlJZIWgyuob9WDTlJ3Zso54ZTQPOwCNzZxdhO RClItmuDNY4PS/ROR7sOJuCR2+B7SQV8ynq6p250uczIH6dweX/aPjhqnbH0+onp gmW7D4pgfjpK31SlHRi8pTj2Dkv/qmmk4keBzm0hcgv0bGhnq3zOePhaiZj5dHmN ivr7C94ntkMUzBZmvdXUfHM7DEype5XLB/E6zcUmqa6bCmGUfJsxCNyWLKCi1o9+ 7tpiuzo9HQ+fq6kcRM7uQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1791027316; x=1791113716; bh=n vvMnStxrImNG+rzjQ3foIIgDk2Rb58zKUv/luq+CAQ=; b=R+7k/BHBYR/7ajKXg 0LoWf0cjFhdexs8oQD1kUfd6sp3aKT6mVvVTlCp2BzW6k6ykFKxG8J+VyKlGVR1o A6rwJa+PMWN26BWz/VopHQ1n82rygT8Ya4eiHzdOPCvrKguTxCoU/YmOY5KfxFnn fnLf5+G4rxWIXCO5jLtFzhqZcQ7RmLx2/Le59nDrWnjiR2/Z3IdmhpkKkRItQK+H 1xhAGAIXjzPz1slCZvYj3IV8P6zwpR0A6qqcY7nZpwCZ7gItmWBW2mIxXJRu9HfX V3tiT5EoBW/4OCdVEQqVykKM9GDxQp5OcTE4IiuP3FRqXaYwjDGR7b8IzxZU+keB ULXhQ== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06; repo=github.com/dkim2wg/interop; date=2026-09-30; sw=lmtpprox; action=sign d=kurilemu.de a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1791027316; d=kurilemu.de; mf=PGFsdmhlcnJlQGt1cmlsZW11LmRlPg==; rt=PHBnc3FsLWhhY2tlcnNAbGlzdHMucG9zdGdyZXNxbC5vcmc+; s=fm3:rsa-sha256:2q/+nSV4wJRA99KqBzOHoy7kvvpWhWGZ6swPBDhhn0lyCqn MCDVxNu3/F4LapM0vkw0h1MmSsV4fCUvHwOmdPgThtN07mIr6bMRJY+n10EeF98N ZYsmjtgCNmTHzpfryOlWKtjlf9wZW19Gx49xVswW/G2dIxmqTGh2uS0iMWjlgjGK pTE4iHMBM7Q7IkntJv8peD46+XixBLD2HPyKGKe6hPuUth+7X6WNsXBoAIDxy+eX /zwysn717dBmmwBmX98cjiqqxiVD6tUEW8TshnisxoqI0u5MKFp9Kkm5mjo8OvFT H4FXlXUEebdSTKUvf/z0WTq7BvKZcEdUA+Sqibw==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06; repo=github.com/dkim2wg/interop; date=2026-09-30; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-transfer-encoding, content-type,date,feedback-id,from,in-reply-to,message-id, mime-version,subject,to; Message-Instance: m=1; h=sha256:cv4U52kFdx0LDx+UVp+FWIiTMTepBRDKqTZFeM7TK04=:ALMY1KWEu7r+C7pJy7s2BT1MKncxXAPsz33mDiwPkIw=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGnNHl/DYlAsg6Wddzil+wFUSoszzgqaFJd2uGlYYcvgxhZ4ycfKRCGF3csVoKQLw 5X+H4eBwqPONRd55vCaZXdDhm3dVl9B/+9cYip9p4EOhjGaw8891AWX2GNYdNcz48mKCCV +upskIuJ55VmB/4nToBcD3AQZ8x87ZVvmPFlbhI2+DxkhJJ2HQlu6i9fQnoaoBinNT7BYC hifwqf1thv5ToV23QOVv6J0JxAz7tTaG9kss4l1yarqPXkCwVSS22uIS2NFFXRquMehUFz jMiAVMg5yYV8yrhGIv2lCJQ9JVe46k42CkC2o1Atc//aEaSVQQ4kYcCOGuEBuGHiWs5chM B060gCfWMgeoX/yQIX6jp8NSFDCrShn6vtvVFYSqomjNC3CAuUlpxvNMEHj/XHK+XEjVEY MyFHdwj//kVlW2XU5YjfBPlbHygWT4Nqp786UBtEna1GUSH//pUsBFAEwSbrGP1+aRIo1D 7AVxmX1el2ZmjvMBixBiLQjdZG2KB0hf9myaaKs4hjf210C66OlojYn63ycHbIQJO9AEbB MkHA2qUIdfxUpWUqu3cvC+UGYvwtlHZUwkh9y2pqDZU+R17WLXGA48isA/J5dKwPRPu1gR mmQ6Fu2P7dK+yDMWiR2wNVNP12dMYEiFcRX0zcK7amiNZGKdb4WTO2qGFXSQ X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 3 Oct 2026 07:35:15 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1791027314; bh=ALMY1KWEu7r+C7pJy7s2BT1MKncxXAPsz33mDiwPkIw=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=x45NSaLYZPoUY6KapJXUw+Nnlv0FkQYdB7V1tfKgoAmlALpmX/ssLNVOGAtB3oRJJ YDmY6RDLA8x2Ax3xjEEGOPft70yb+fxyRdefigpaK3b6Fepfobe+JMW5forkkusJIA oO1kgVuHX35HfH6LBG8m8SLuaW94R9PmSHFHe7rIzZ/3VVw9TS4ZBFYQMnUKLduFw6 iPqMaDMU+FtU3COOgHczufxrxePjSwxrJgzm7Y8HdTZjc7O5JnpcV9Oo4VzgOWPyXL ggsHkLfOVwpHfI46bepUVtxMvbtGmsDIYtHeyVQ1pdXIwSWq0OlWe66HTe0c0oEHeR X1030BoUIwu+Q== Received: by ida.kurilemu.internal (Postfix, from userid 1000) id 59ABDB001C7; Sat, 03 Oct 2026 13:35:14 +0200 (CEST) Date: Sat, 3 Oct 2026 13:35:14 +0200 From: Alvaro Herrera To: Radim Marek Cc: Antonin Houska , PostgreSQL Hackers Subject: Re: REPACK (CONCURRENTLY) might keep dropped-column data Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Sep-30, Radim Marek wrote: > Ok, I can't add much to the implementation discussion, but I can confirm > the patch resolves both use cases I reported. Thank you, I have pushed it to both branches after adjusting the test case a bit more. I also noticed a problem in the implementation. We originally did this: CompactAttribute *attr = TupleDescCompactAttr(desc, i); varlena *varlena_dst; if (attr->attisdropped) + { + dest->tts_isnull[i] = true; continue; + } if (attr->attlen != -1) continue; if (slot_attisnull(dest, i + 1)) continue; slot_getsomeattrs(dest, i + 1); Notice the slot_getsomeattrs() at the bottom: that is saying that if the slot has not yet been deformed up to this attribute, then a subsequent pass over the loop might overwrite the change of dest->tts_isnull[] we did for this attribute! In order to do this correctly, we must ensure that the slot has been deformed up to that point, and _then_ we can modify tts_isnull. So I added another slot_getsomeattrs() call inside the attisdropped() block. But, really, the case where tts_isnull is already true for dropped columns is by far the most common; it would be a shame to have to deform a bunch of attributes only for there to be nothing to do. So I threw in a test that the attribute is not already marked as null. if (attr->attisdropped) + { + if (!slot_attisnull(dest, i + 1)) + { + slot_getsomeattrs(dest, i + 1); + dest->tts_isnull[i] = true; + } continue; + } This way, we don't waste work. (In practice, I don't expect this to have any effect, because the slot uses the Virtual tts_ops, so it doesn't require deforming. But better to do things by the book just in case.) Thanks, -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente"