pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedAssert failure when CREATE TEMP TABLE
4+ messages / 3 participants
[nested] [flat]
Commits from this thread:
2023-10-16 1e678175c5 07eb22a776 f6e1ee3cfa a295684b89 54b208f909 57e6e861d4 0d1a7cd14e Ensure we have a snapshot while dropping ON COMMIT DROP temp tables.
* Assert failure when CREATE TEMP TABLE
@ 2023-10-16 11:02 Richard Guo <guofenglinux@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Richard Guo @ 2023-10-16 11:02 UTC (permalink / raw)
To: pgsql-bugs
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;
The failure happens in init_toast_snapshot():
/*
* Catalog snapshots can be returned by GetOldestSnapshot() even if not
* registered or active. That easily hides bugs around not having a
* snapshot set up - most of the time there is a valid catalog snapshot.
* So additionally insist that the current snapshot is registered or
* active.
*/
Assert(HaveRegisteredOrActiveSnapshot());
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.
Thanks
Richard
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Assert failure when CREATE TEMP TABLE
@ 2023-10-16 15:46 Tom Lane <tgl@sss.pgh.pa.us>
parent: Richard Guo <guofenglinux@gmail.com>
0 siblings, 2 replies; 4+ messages in thread
From: Tom Lane @ 2023-10-16 15:46 UTC (permalink / raw)
To: Richard Guo <guofenglinux@gmail.com>; +Cc: pgsql-bugs
Richard Guo <guofenglinux@gmail.com> 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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Assert failure when CREATE TEMP TABLE
@ 2023-10-17 09:00 Alexander Lakhin <exclusion@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 4+ messages in thread
From: Alexander Lakhin @ 2023-10-17 09:00 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Richard Guo <guofenglinux@gmail.com>; +Cc: pgsql-bugs
16.10.2023 18:46, Tom Lane wrote:
> Richard Guo <guofenglinux@gmail.com> writes:
>> I came across an Assert failure while running sqlancer. The repro query
>> is
> 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.
That's very similar to bug #18127, and looks like one more case to the
collection [1], with RemoveConstraintById() -> CatalogTupleDelete() ->
simple_heap_delete() ...
https://www.postgresql.org/message-id/9541c507-a325-7768-38b0-90f6532c01e3%40gmail.com
Best regards,
Alexander
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Assert failure when CREATE TEMP TABLE
@ 2023-10-18 06:57 Richard Guo <guofenglinux@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 4+ messages in thread
From: Richard Guo @ 2023-10-18 06:57 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
On Mon, Oct 16, 2023 at 11:46 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Richard Guo <guofenglinux@gmail.com> writes:
> > 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'".
Ah, this clears up my confusion. Thanks for the fix.
Thanks
Richard
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2023-10-18 06:57 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-10-16 11:02 Assert failure when CREATE TEMP TABLE Richard Guo <guofenglinux@gmail.com>
2023-10-16 15:46 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-10-17 09:00 ` Alexander Lakhin <exclusion@gmail.com>
2023-10-18 06:57 ` Richard Guo <guofenglinux@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox