Re: Pg18 Recursive Crash

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Paul Ramsey <pramsey@cleverelephant.ca>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>, dgrowleyml@gmail.com
Date: 2024-12-16T18:10:55Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Optimize grouping equality checks with virtual slots

  2. Fix Assert failure in WITH RECURSIVE UNION queries

  3. Fix incorrect slot type in BuildTupleHashTableExt

Thanks for the report!

On Mon, Dec 16, 2024 at 09:50:39AM -0800, Paul Ramsey wrote:
> Apologies if this is already reported, but there´s a crasher in recursive
> queries at the head of the current development that happened to be
> exercised by our regression suite. Here is a core-only reproduction.
> 
> CREATE TABLE foo (id integer, x integer, y integer);
> INSERT INTO foo VALUES (1, 0, 1);
> INSERT INTO foo VALUES (2, 1, 2);
> INSERT INTO foo VALUES (3, 2, 3);
> 
> WITH RECURSIVE path (id, x, y) AS (
>     SELECT id, x, y FROM foo WHERE id = 1
>     UNION
>     SELECT foo.id, foo.x, foo.y
>     FROM path, foo
>     WHERE path.y = foo.x
> )
> SELECT 'crash', id, x, y FROM path;

git-bisect is pointing me to https://postgr.es/c/0f57382.  Here is the
trace I'm seeing:

	TRAP: failed Assert("op->d.fetch.kind == slot->tts_ops"), File: "../postgresql/src/backend/executor/execExprInterp.c", Line: 2244, PID: 5031
	0   postgres                            0x000000010112d068 ExceptionalCondition + 108
	1   postgres                            0x0000000100e54f04 ExecInterpExpr + 604
	2   postgres                            0x0000000100e5bd50 LookupTupleHashEntry + 116
	3   postgres                            0x0000000100e8e580 ExecRecursiveUnion + 140
	4   postgres                            0x0000000100e770c0 CteScanNext + 248
	5   postgres                            0x0000000100e66e9c ExecScan + 124
	6   postgres                            0x0000000100e5dc9c standard_ExecutorRun + 304
	7   postgres                            0x0000000100ffe6dc PortalRunSelect + 236
	8   postgres                            0x0000000100ffe2f8 PortalRun + 492
	9   postgres                            0x0000000100ffd298 exec_simple_query + 1276
	10  postgres                            0x0000000100ffaf24 PostgresMain + 3632
	11  postgres                            0x0000000100ff631c BackendInitialize + 0
	12  postgres                            0x0000000100f5d638 PgArchShmemSize + 0
	13  postgres                            0x0000000100f61518 ServerLoop + 4300
	14  postgres                            0x0000000100f5fc60 InitProcessGlobals + 0
	15  postgres                            0x0000000100eb1e7c help + 0
	16  dyld                                0x000000019ed3b154 start + 2476

-- 
nathan