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 1wZzLi-001S93-2E for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 23:07:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wZzLg-00846K-17 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 23:07:08 +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 1wZzLg-00846C-0C for pgsql-hackers@lists.postgresql.org; Wed, 17 Jun 2026 23:07:08 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wZzLd-00000000zZR-3qSa for pgsql-hackers@lists.postgresql.org; Wed, 17 Jun 2026 23:07:07 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-45fd461e4a5so273835f8f.0 for ; Wed, 17 Jun 2026 16:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781737624; cv=none; d=google.com; s=arc-20240605; b=GKGt7/PjO7Bh2bMnyPEM1ZoIyG/9J2m6z/BYK0ciWC1N17qRCmqA9Fjl4pKgoqoH4Z kuaKcCR/GVHj4gVl5W7ijC6+hgJ0BcEZ/BTczd0+mnLrKXggjdLU7E9dCKPAt76VljfS Unha5gg+y2NP5mdUx8Fwf5s5mwXUYX8aJWLXAyhZvzXT3n5fby2NrIEhW+oEavrZSTAG Lm0+ElXiUGPnzmbPqgwZ2db54tX93zfj0eLkFcXx53W/ZkLKLDZoc4bhpBAaW5Xr779o nThof8qgOWp6yP0am7vralr7QRQvzr8RmIfeMyCirTteBOteB59q0uxJ6FKFMrnJz+QV MZfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=wgHzeftNc0YL7S55D0YaxvLgxPud6Fl9UpEXYUCfLUE=; fh=80LSK6l6n5jotEeTuCMF3RL0L8xrO7Zo60DzJeG7jww=; b=k0Nq193H5wCYqPljp+zKqYuRuHhTX+uMCwsTF5+Da8kqGEGIwiwNU6eKwsdNouMnCW zVsjBUBa+WN+0XA7ugbHkbU6ZzWJMwTA+zShrJWZV/DmcM2+m1RXf/U9vWqIc8osxSbc CxyNH/KqvVB3EsvAysZ8ODPhCoJegzM5IMhuj5JH/YM0DGUNPuP8hkiqEdDHwvC/cQSF tRlBUeYmz+hffOCglLLve1ovFYNtAQKbnA4WG27EUmK1T6S5A9oKTXzmLuKoPHQK6Ean wRCk6qQgZ4pwVE/I+9YaoG7FIxTVvulx3ioM0INugZzXqc/rB8cyEwrIzCJ93VAL+5Sv l63w==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781737624; x=1782342424; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wgHzeftNc0YL7S55D0YaxvLgxPud6Fl9UpEXYUCfLUE=; b=lRwPR9MPQR7bEAuFFNuAOKNFIfLhjX7/Jx2M/l2a76uaJU1tzLVbISG8F1VI6JznUq FGui6cQLN8Nhpv2JzQ+zPwPrbrb+xO1ZUe5virXuGsQhvuF86+xbjIQcP0dDusx1YQP2 E135r2lpn36oNuzSTtd+D97OJxg/Nc0WKoiU2oep0253S7x93aqksCe5KLOfOK3/fYBS 8qHP4Q86VdB9Uf2iKNj5qil2db2Z8bu2kD/6bw9kuTjbu1b5dEhXbs1ZAsAGXPCO1/S/ DjzaWZ4ZwYZjL8vO/wuAZ0Lt6YLUz8kj8i+XHZ8hoWPI4DqJGCeLzTzlsCNs0oOHJn+C JChQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781737624; x=1782342424; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wgHzeftNc0YL7S55D0YaxvLgxPud6Fl9UpEXYUCfLUE=; b=pNaZf/idzcbQnBDYLxXGiZsUmGIywuAM/ciuEeKx93VoiDrohJ3AheRUlNYteOPSSU LtgEnQGUIeqklii04/L0rUE4iTijzBgGdP7gDdI+KLxP4cioGC6oEJSxCbe4n/wPK27v SpjCeTda/TGfLM1JWcI/ffQmCOijv5ZIjlztX+In85TF9iEpSBpTrG15+exemCEs7Dxa 8F6lvM0H6W5GnQhF5GPnX7Z0vDqwSy+bUEW89Spuuw7QjFGqwHw5oFMjmR4LgollZwXO vKxOkjb0SRrukltIKnmz9ZdeGq5b46Gi31R0EvFyI71w8KH+gqk1BXNuTkvZXVFVDFCU PVrQ== X-Forwarded-Encrypted: i=1; AFNElJ8jgwvqiiSHDi8lGP1GsvICVZmqYQkSLdMFG1tDMy3iqbZE42OXU3yLIfSY3EW8HoZIMAdEyIZOiGi+1t7g@lists.postgresql.org X-Gm-Message-State: AOJu0Yx7ROXRAf2lSiS2hn6N9uOfpzmD5MQ8Jp0goLTedr52M4IrOIEz uxfvFEw7Yf5dUwsE9w5vjSv1rhhRhqE8HJLGiD61mscjtJfouVBr3Ogl2ma9LfhQKiMxKCfAfSL eIHEh1zI/Z+yjeBnAbT4RZTZHRnLLSGk= X-Gm-Gg: AfdE7cn+7cBqOwomQV0BlUxYyJ9fiZuyr596KJ36rvGnumRluwrbipf1yGHGu2ddbP9 1bv0ih9HYIKY65E6rflR4OAkDmDtnjcqFVAmF19aK9PedjR+qIpC11mNEZxckn81PWHU2SYSTOw /lGRtTfHYGcRSWofoenM2cPeaUY+qCDrJSf/bHn51aFRe5N46ZQU6u5H6qUoSEOOiPxOxMR2z/y 8a2BQqc3RzesHSnZtEHRmXkPqZPzeKLoPCPsLql9RIypWGRe10O0cdCezvQb+IX5aUkpOGBiDsO +DRbB5mlRGWHnN7b+YeGRyjUQiCUS8PUY5tYpFwu+8Lvs24hCj0an7983yDiwc/S8/2eM74= X-Received: by 2002:a5d:4e82:0:b0:460:1957:1b33 with SMTP id ffacd0b85a97d-4623ea35d05mr7706649f8f.3.1781737624270; Wed, 17 Jun 2026 16:07:04 -0700 (PDT) MIME-Version: 1.0 References: <1151393.1781734980@sss.pgh.pa.us> <1174236.1781736349@sss.pgh.pa.us> In-Reply-To: <1174236.1781736349@sss.pgh.pa.us> From: David Rowley Date: Thu, 18 Jun 2026 11:06:54 +1200 X-Gm-Features: AVVi8CdxSlRqkUQsd3iTRsgwMKMm7StV00qNSipuzmDcZgZ2302JcCjzjL0PAEs Message-ID: Subject: Re: Fix tuple deformation with virtual generated NOT NULL columns To: Tom Lane Cc: Chao Li , Peter Eisentraut , Andres Freund , Postgres hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 18 Jun 2026 at 10:45, Tom Lane wrote: > set jit = 1; > set jit_above_cost = 0; > set jit_optimize_above_cost = 1000; > CREATE TABLE gtest21c (a int NOT NULL, b int GENERATED ALWAYS AS (a * 2) VIRTUAL NOT NULL, c int NOT NULL); > INSERT INTO gtest21c (a, c) VALUES (10, 42); > table gtest21c; > > I conclude that something in the JIT code for tuple formation > is unaware of virtual generated columns. Just starting to look now, but I suspect that this code in llvmjit_deform.c needs to be updated now that we have virtual generated columns. /* * If the column is declared NOT NULL then it must be present in every * tuple, unless there's a "missing" entry that could provide a * non-NULL value for it. That in turn guarantees that the NULL bitmap * - if there are any NULLable columns - is at least long enough to * cover columns up to attnum. * * Be paranoid and also check !attisdropped, even though the * combination of attisdropped && attnotnull combination shouldn't * exist. */ if (att->attnullability == ATTNULLABLE_VALID && !att->atthasmissing && !att->attisdropped) guaranteed_column_number = attnum; David