"=?UTF-8?B?6LW15bqt5rW3KOW6reeroCk=?=" <zhaotinghai....@alibaba-inc.com> writes: > I recently notice these sql can lead to a assertion error in pg14 and older > version. Here is an example: > postgres=> CREATE TABLE t1 (a int); > postgres=> INSERT INTO t1 VALUES (1); > postgres=> SELECT EXISTS ( SELECT * FROM t1 GROUP BY GROUPING SETS ((a), > generate_series (1, 262144)) ) AS result; > server closed the connection unexpectedly
In current v14 this produces: TRAP: FailedAssertion("!lt->writing || lt->buffer == NULL", File: "logtape.c", Line: 1279, PID: 928622) Thanks for the report. I did some bisecting and found that the crash appears at Jeff's commit c8aeaf3ab (which introduced this assertion) and disappears at Heikki's c4649cce3 (which removed it). So I would say that the problem is "this assertion is wrong", and we should fix the problem by fixing the assertion, not by hacking around in distant calling code. On the whole, since this code has been dead for several versions, I'd be inclined to just remove the assertion. I think it's quite risky because of the possibility that we reach this function during post-transaction-abort cleanup, when there's no very good reason to assume that the tapeset's been closed down cleanly. (To be clear, that's not what's happening in the given test case ... but I fear that it could.) regards, tom lane