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 1ty4Jw-001y73-P7 for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Mar 2025 07:40:05 +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 1ty4Jt-004uDK-3u for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Mar 2025 07:40:01 +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.94.2) (envelope-from ) id 1ty4Js-004uDC-MF for pgsql-hackers@lists.postgresql.org; Fri, 28 Mar 2025 07:40:00 +0000 Received: from air.basealt.ru ([193.43.8.18]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ty4Jq-001fB6-0M for pgsql-hackers@lists.postgresql.org; Fri, 28 Mar 2025 07:39:59 +0000 Received: from [192.168.1.143] (host-109-171-38-224.bbcustomer.zsttk.net [109.171.38.224]) (Authenticated sender: gorbanyoves) by air.basealt.ru (Postfix) with ESMTPSA id 9857C2338E for ; Fri, 28 Mar 2025 10:39:56 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basealt.ru; s=dkim; t=1743147596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=DnPO0cKEL5HtCyO78Cso4AfGs7n1tzafVvd7QUZSd/8=; b=Db6m7fQ1cAIrfuUCwVJkNlMMY3N4M9vXBmGoBeLjOMVkpWvEQekyUz79NaUeQihOPRI8cD 08+Nut8RaFeaXC2W9MShpoNkWJzYhqJkhSNXP9pR9ZhpjOiSSMHt0QFGLey8N90fe8TDfb M2VPpRfiMpWebXgFVguevtWnQ7W6gsHt3dKvLMqy937/Ub5YHnr4GzbY6cXTeCUDNHq6XP s2iVyegXXcmHlXNX8qij++UOTaZph4wF6iU20CvaCFzKU2le4imRX1CYaLAfcNwSXqKAO9 pt9npgT3YRqzJyTrasUbllA7eAe/Mgz+ukm4an5S7x+xGCLMvT8TWaBZxrI5uw== Content-Type: multipart/mixed; boundary="------------BBVnCuhLaLCNlpgXvcfWuhdL" Message-ID: <6bac9886-65bf-4cec-96bd-e304159f28db@basealt.ru> Date: Fri, 28 Mar 2025 13:39:55 +0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: pgsql-hackers@lists.postgresql.org Content-Language: en-US From: =?UTF-8?B?0JXQstCz0LXQvdC40Lkg0JPQvtGA0LHQsNC90LXQsg==?= Subject: Assert failure in base_yyparse List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------BBVnCuhLaLCNlpgXvcfWuhdL Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello. Got an assert failure when fuzzing the raw_parser function. The query to reproduce: SELECT xmltable.* FROM xmltest2, LATERAL xmltable('/d/r' PASSING x COLUMNS a int PATH '' || lower(_path) is_not_null|| 'c'); If I understand correctly, is_not_null is considered as a valid keyword in xmltable, but it gets the type T_A_Expr. Postgres output: $ ./postgres -D data 2025-03-28 12:19:19.945 +06 [53058] LOG:  starting PostgreSQL 18devel on x86_64-pc-linux-gnu, compiled by x86_64-alt-linux-gcc (GCC) 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2), 64-bit 2025-03-28 12:19:19.946 +06 [53058] LOG:  listening on IPv4 address "127.0.0.1", port 5432 2025-03-28 12:19:20.032 +06 [53058] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432" 2025-03-28 12:19:20.281 +06 [53064] LOG:  database system was shut down at 2025-03-28 12:18:37 +06 2025-03-28 12:19:20.342 +06 [53058] LOG:  database system is ready to accept connections TRAP: failed Assert("ptr == NULL || nodeTag(ptr) == type"), File: "../../../src/include/nodes/nodes.h", Line: 177, PID: 53069 postgres: user postgres 127.0.0.1(56762) idle(ExceptionalCondition+0x141)[0x5561768c0fb6] postgres: user postgres 127.0.0.1(56762) idle(+0x585784)[0x556175e03784] postgres: user postgres 127.0.0.1(56762) idle(base_yyparse+0x30578)[0x556175e33f83] postgres: user postgres 127.0.0.1(56762) idle(raw_parser+0xf5)[0x556175ec0f47] postgres: user postgres 127.0.0.1(56762) idle(pg_parse_query+0x63)[0x556176550a67] postgres: user postgres 127.0.0.1(56762) idle(+0xcd3bcf)[0x556176551bcf] postgres: user postgres 127.0.0.1(56762) idle(PostgresMain+0x14ef)[0x55617655ca54] postgres: user postgres 127.0.0.1(56762) idle(+0xccc207)[0x55617654a207] postgres: user postgres 127.0.0.1(56762) idle(postmaster_child_launch+0x2ae)[0x5561763ad6e8] postgres: user postgres 127.0.0.1(56762) idle(+0xb3bc75)[0x5561763b9c75] postgres: user postgres 127.0.0.1(56762) idle(+0xb3686b)[0x5561763b486b] postgres: user postgres 127.0.0.1(56762) idle(PostmasterMain+0x288f)[0x5561763b3bdb] postgres: user postgres 127.0.0.1(56762) idle(main+0x5dc)[0x55617616dfbd] /lib64/libc.so.6(__libc_start_main+0xcd)[0x7f36ef05fefd] postgres: user postgres 127.0.0.1(56762) idle(_start+0x2a)[0x556175b4a39a] 2025-03-28 12:19:24.020 +06 [53058] LOG:  client backend (PID 53069) was terminated by signal 6: Aborted 2025-03-28 12:19:24.020 +06 [53058] DETAIL:  Failed process was running: SELECT xmltable.* FROM xmltest2, LATERAL xmltable('/d/r' PASSING x COLUMNS a int PATH '' || lower(_path) is_not_null|| 'c'); 2025-03-28 12:19:24.020 +06 [53058] LOG:  terminating any other active server processes 2025-03-28 12:19:24.021 +06 [53058] LOG:  all server processes terminated; reinitializing 2025-03-28 12:19:24.220 +06 [53080] LOG:  database system was interrupted; last known up at 2025-03-28 12:19:20 +06 2025-03-28 12:19:28.268 +06 [53080] LOG:  database system was not properly shut down; automatic recovery in progress 2025-03-28 12:19:28.296 +06 [53080] LOG:  invalid record length at 0/17864A0: expected at least 24, got 0 2025-03-28 12:19:28.296 +06 [53080] LOG:  redo is not required 2025-03-28 12:19:28.414 +06 [53081] LOG:  checkpoint starting: end-of-recovery immediate wait 2025-03-28 12:19:28.561 +06 [53081] LOG:  checkpoint complete: wrote 0 buffers (0.0%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.014 s, sync=0.004 s, total=0.183 s; sync files=2, longest=0.002 s, average=0.002 s; distance=0 kB, estimate=0 kB; lsn=0/17864A0, redo lsn=0/17864A0 2025-03-28 12:19:28.618 +06 [53058] LOG:  database system is ready to accept connections ^C2025-03-28 12:19:30.116 +06 [53058] LOG:  received fast shutdown request 2025-03-28 12:19:30.259 +06 [53058] LOG:  aborting any active transactions 2025-03-28 12:19:30.313 +06 [53081] LOG:  shutting down 2025-03-28 12:19:30.464 +06 [53081] LOG:  checkpoint starting: shutdown immediate 2025-03-28 12:19:30.515 +06 [53081] LOG:  checkpoint complete: wrote 0 buffers (0.0%), wrote 0 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.001 s, total=0.202 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=0 kB; lsn=0/1786518, redo lsn=0/1786518 2025-03-28 12:19:30.665 +06 [53058] LOG:  database system is shut down Prepared a patch to fix it, but there may be a better solution. --------------BBVnCuhLaLCNlpgXvcfWuhdL Content-Type: text/x-patch; charset=UTF-8; name="0001-Fix-usage-of-is_not_null-in-xmltable.patch" Content-Disposition: attachment; filename="0001-Fix-usage-of-is_not_null-in-xmltable.patch" Content-Transfer-Encoding: base64 RnJvbSBlNTRkYmUxOTBhMGU1YTBiYmJhZGQwN2FmOGFhNmIyNDQzM2FkMDJhIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjA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