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.94.2) (envelope-from ) id 1qsPo7-007wo0-CH for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Oct 2023 15:47:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qsPo5-0026l2-2o for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Oct 2023 15:47:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qsPo4-0026jw-QW for pgsql-bugs@lists.postgresql.org; Mon, 16 Oct 2023 15:47:01 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qsPo0-000m7D-3V for pgsql-bugs@postgresql.org; Mon, 16 Oct 2023 15:47:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 39GFksoa2301836; Mon, 16 Oct 2023 11:46:54 -0400 From: Tom Lane To: Richard Guo cc: pgsql-bugs@postgresql.org Subject: Re: Assert failure when CREATE TEMP TABLE In-reply-to: References: Comments: In-reply-to Richard Guo message dated "Mon, 16 Oct 2023 19:02:29 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2301834.1697471214.1@sss.pgh.pa.us> Date: Mon, 16 Oct 2023 11:46:54 -0400 Message-ID: <2301835.1697471214@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > I came across an Assert failure while running sqlancer. The repro query > is > CREATE TEMP TABLE t0 (c0 int4range CHECK ((('')||(0.005014271491241007) NOT > IN (upper(''), ((' 9O')||FALSE))) BETWEEN SYMMETRIC > (initcap('dj')LIKE(((('EizW~')||t0.c0) COLLATE "en_AG.utf8"))) AND > ((((0.18773675)::MONEY) IN (0.52246463::MONEY))AND(t0.c0 BETWEEN SYMMETRIC > ((t0.c0+t0.c0)) AND t0.c0)))) USING heap ON COMMIT DROP; Hmm. AFAICT, the critical thing about this CHECK condition is simply that it's bulky enough to create an out-of-line toasted "conbin" field in pg_constraint. When we come to ON COMMIT DROP, we have to delete the pg_constraint entry and thereby the toast item, and we evidently lack a snapshot at that point. > And 'git bisect' says that the first bad commit is 2489d76c, which makes > me confused because the problemed query does not seem to involve > nullingrels stuff. Probably the reason is that addition of nullingrels fields to the Vars pushed it over the edge of needing to be out-of-line. The test case is very close to the line as stated --- for example, I found that it didn't crash if I changed "en_AG.utf8" to "C", and wasted some time pursuing the idea that the collation had something to do with it. The crash got much more stable after adding a couple more dummy clauses to the CHECK condition, and I've also reproduced it with clauses as straightforward as "c0 < 'very-long-constant'". regards, tom lane