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.96) (envelope-from ) id 1wEoq1-004RZ4-0B for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Apr 2026 13:38:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wEoq0-002pGg-0L for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Apr 2026 13:38:56 +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.96) (envelope-from ) id 1wEopz-002pGY-2Y for pgsql-bugs@lists.postgresql.org; Mon, 20 Apr 2026 13:38:55 +0000 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wEopx-000000028Zl-230l for pgsql-bugs@lists.postgresql.org; Mon, 20 Apr 2026 13:38:55 +0000 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-479d85152c9so223239b6e.2 for ; Mon, 20 Apr 2026 06:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776692331; cv=none; d=google.com; s=arc-20240605; b=RJ+OM8qb+Tz5RAbC4wtgD6g4Rrr2245xWayfY6HdwbSbG8ebHYaQ7EaDw83p9tvFNN VMZAdg3q3uxrrYCD+MDaYlfObvWDH435JGoNJcKKDmWd1qQQpZtl/tIbRlvXHSYrkBMI aRaW5sm4j/NTSmprz4eb4zmdc0mq+f+ZUGZMk8xhE3C36ezg98rsO091Nfj9Eagkonq/ +9GZV3fR1MhZVGYNZDWSG37z3SvOUAIKX+CxDAf+ymjhOLFdeGxPI3GJGqxfte1ufhBE tkK+FHSolhyNA8m0++08X650Q8ZxolnHHgC9BqvsxtX1iBzw4yqur2ALCnfpX0WoOifg +RmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=MTQ2ZJspo8oyY0ImLlFeGvc/CVrxLJrjaWVwGWT/oig=; fh=6ZITAynogAifh6oqN86Z+6cz+KAeIivFb0ALimgOcYU=; b=XId3NSm5EKipxogzdRcXI1UACEB5X83OXcDmIcN7uLwdK09m6+DvsYi19sG4mXlUGJ DgrWG28BgG/aJt1jvn6OKDk7HPsVzPn5x5DWHuBi/bDa3S+lu4nVunDwQHYPnAAncb4u c7RfMi28GBQDSpm3CnduiFaJRSBxrDbTyjjbSenM3EnEaiDJkCbKpjDrPdN3cFqJ2XJ8 YrFNa0muNqXotizXh0lERMcAw3Zh+ZtXbHJ6tRT6YpLu8ulGSQiFIut2xqUiuU/5GsbL j1RQtMVL2kIj1qFMBZmMKc6lkgGZCnc4su/ClKxdQaeYsu3jMhb/LzgiAtXdf5lBObkG MOEw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776692331; x=1777297131; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MTQ2ZJspo8oyY0ImLlFeGvc/CVrxLJrjaWVwGWT/oig=; b=nwSvSQDjE7hRdZ1AjcRsv8HZ8xjWKruDR1KyO6LWg/NasHMZSrcm4nsbu6MnSW4Bl+ fNUNRn2g5lWsj83W9RDX95KQwv0mWKu+mvwJ2zd8of9Uuy1Q+5PNIlmUqCLcopwIgNb2 ftkjHY2cOYXF+EkD0xcA4GMrLztuPUlD/OMFlJ+l6N72+mmY2TAVag6l0mv1AGO3gm6q xyTN/OfYm1+7wyxLjo/zrQZL+KSWS5oyThhlAG8b2re1G97fH4ANEvfwLRg2cnd6fHcf PjrhP+wYdAw8JcjHHhK5Ktd6ekiLDvshZmwsqh400YtXhcot+WWyg37vVn3sBgLRpb6W NVUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776692331; x=1777297131; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MTQ2ZJspo8oyY0ImLlFeGvc/CVrxLJrjaWVwGWT/oig=; b=jgZD75YDjSld6gy4GuU5N2pE0GG0+NDpZiICILFF42oVQfh2kc3v/b7JXJXuvKSmhM camvJtxK/5q7xj/ilb4JA5UmmdX2XkUnzOduZMZSXku2j8cmUWtJybF0uo6w1+t6PSlQ vPoMp33ukaObc2q4mo4IlmFCWKnPrIHtbHHnvSBQbAWRnN1aPvUOjRElLkcUP9ZF/9VT 6C0cJdBgZUNkJlwSsMCABhlJOW8owoUt4ejwzUQa5T2D0YXxcw2D6QcbIloGteoCljAr oBLZ6Q94faJ8IO8rcVNomd+0PhEKCc93D44mGu+3faiugE1p3dIe0HYp9XUWmdt1cdAH x5Kw== X-Forwarded-Encrypted: i=1; AFNElJ/RSUP4v5aqYd8NY6Oh/sXlj3xi6y9805rsmWX57a1N4dDzNK5zJ1E0l8gvl8zzsXAqO+WxEQjoFbvG@lists.postgresql.org X-Gm-Message-State: AOJu0YyPcaxzdNg5IFeCqR+WmrqIHdAEiW+gcJihwQljzdyGUWs6lv+5 F/qKF8fP7nKFKsEa62NKMCShkCyOBU2OC3fKwb9q1ANrp59HZLOr/+khyfCe/P9a84VU6qo0cQb MxIu8vsAzL2asu7q0c4hHSpmvNkekbCl66iGcYH0= X-Gm-Gg: AeBDietb8R/mQ6z49n+KFGMfzFMHfHHM7gujtZRk3K/K+T0OcqNVsaCVBdrak9LfWDG V60yYFaRfQUfJq9Xam44VjJ2r0YBlpoOK4aqdMqOKXzUqBbeVyYAJbzXDjFCDfHh/ol3FTGK9Ap IYPch946FG7xIwGJglxu7UnsVYU1sNbDdEzQzRhh8lM3TsgpxhecHOCiJkKTm0ix3jsaPUH47Kk I7pmwgjZ25IXc+bICGcl+7MruCTisHmK3B9TLPGlIXTu7bANCLA3V1xMIPK6XuiNXW7NlkFYrG2 HZ0OPPt88aHYb9cxCuMGTVnx0dzW X-Received: by 2002:a05:6808:1442:b0:469:fca3:e611 with SMTP id 5614622812f47-4799ca8508cmr6476368b6e.28.1776692331193; Mon, 20 Apr 2026 06:38:51 -0700 (PDT) MIME-Version: 1.0 References: <19458-a69c98bc498333ba@postgresql.org> In-Reply-To: <19458-a69c98bc498333ba@postgresql.org> From: Andrey Rachitskiy Date: Mon, 20 Apr 2026 18:38:38 +0500 X-Gm-Features: AQROBzB47H6pYmZjHKah49IC6naThYHRu9T3Iea4_Kl3jn95mGK204pKS8haV4E Message-ID: Subject: Re: BUG #19458: OOM killer in jsonb_path_exists_opr (@?) with malformed JSONPath containing non-existent variables To: pl0h0yp1@gmail.com, pgsql-bugs@lists.postgresql.org Cc: dhyan@nataraj.su Content-Type: multipart/mixed; boundary="00000000000046c563064fe46b18" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000046c563064fe46b18 Content-Type: multipart/alternative; boundary="00000000000046c562064fe46b16" --00000000000046c562064fe46b16 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I propose a targeted backpatch for REL_14/15/16 in jsonpath_exec.c to align missing variable handling with newer branches and prevent pathological memory growth on malformed/hostile jsonpath expressions. Why this is not a full backport This is intentionally not a full backport of the REL_17 jsonpath executor refactoring (callbacks for variable access, broader executor integration, etc.). Why this still fixes the reported issue On REL_14/15/16, with current behavior (missing vars -> null), some crafted jsonpath expressions continue deep evaluation and can consume very large memory, leading to OOM. With this patch, execution fails early on undefined variable, matching REL_17 behavior for this case and avoiding runaway memory use. =E2=80=94 Regards, Andrey Rachitskiy Postgres Professional =D0=BF=D1=82, 17 =D0=B0=D0=BF=D1=80. 2026=E2=80=AF=D0=B3. =D0=B2 16:21, PG = Bug reporting form : > The following bug has been logged on the website: > > Bug reference: 19458 > Logged by: Andrey Rachitskiy > Email address: pl0h0yp1@gmail.com > PostgreSQL version: 14.22 > Operating system: Debian GNU/Linux 12 (bookworm) > Description: > > Description: > During fuzzing of the jsonb_path_exists_opr (operator jsonb @? jsonpath, = a > two-argument version of jsonb_path_exists()), a pathological query was > discovered that causes uncontrolled memory consumption, leading to OOM > Killer on PostgreSQL versions REL_14/15/16_STABLE. > On versions 17 and 18, the same query returns a proper error instead of > crashing the server. > This bug was found using AFL++ as a fuzzer and LibBlobStamper as a tool f= or > creating syntactically correct arguments. > > Reproduction: > Execute the following query: > ```sql > select '[3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 13558284848669739, 3472328296227668016, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328295419228208, 3472328296227680304, > 3528904766546522246, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296328343600, > 3472328296227680304, 3472328296227680299, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3470920921344127024, 3906362710315511856, > 3472328296228075062, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472334893297446960, 3472328090069248816, > 13511005849006128, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 3472328296227680304, 3472328296227680304, 3472328296227680304, > 13563782407139376, 4337019423877509168]'::jsonb @? '(-$?(0 < > ($"=E3=80=B0=E3=80=AD=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= =E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0" -= $?(0 < $"=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= =E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0" - $?(0 + $= < > $"=E3=98=B0=E3=80=B0=E3=98=B6=E3=80=B0")."=E3=80=B0=E3=80=B0=E3=80=B0=E3= =80=B0")."=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= =E3=80=B0") - 0?(+$ < $"=E3=80=B0 > > =E3=80=B0=E3=80=B0=E3=80=B0")."=E3=81=BB=E3=80=B0=E3=80=B0=E3=98=B0")."= =E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B6=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= =E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= =E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0")'::j= sonpath; > ``` > > Expected result: > The query should return an error, as happens on versions 17 and 18: > ERROR: could not find jsonpath variable "=E3=80=B0=E3=80=AD=E3=80=B0=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= =E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0" > > Actual result (14, 15, 16): > - Memory consumption grows until the kernel kills the postgres process > via > OOM Killer > - Client loses connection: > server closed the connection unexpectedly > This probably means the server terminated abnormally > before or while processing the request. > > Kernel log: > 516294.487767] Out of memory: Killed process 1135405 (postgres) > total-vm:13521932kB, anon-rss:9170792kB, file-rss:92kB, shmem-rss:1848kB, > UID:1002 pgtables:26176kB oom_score_adj:0 > > -- > Regards, > Andrey Rachitskiy > Postgres Professional > > > --00000000000046c562064fe46b16 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I propose a targeted backpatch for REL_14/15/16 in jsonpat= h_exec.c to align missing variable handling with newer branches and prevent= pathological memory growth on malformed/hostile jsonpath expressions.
<= br>Why this is not a full backport
This is intentionally not a full back= port of the REL_17 jsonpath executor refactoring (callbacks for variable ac= cess, broader executor integration, etc.).

Why this still fixes the = reported issue
On REL_14/15/16, with current behavior (missing vars ->= ; null), some crafted jsonpath expressions continue deep evaluation and can= consume very large memory, leading to OOM.
With this patch, execution f= ails early on undefined variable, matching REL_17 behavior for this case an= d avoiding runaway memory use.

=E2=80=94
Regards,
Andrey Rachi= tskiy
Postgres Professional

=D0=BF=D1=82, 17 = =D0=B0=D0=BF=D1=80. 2026=E2=80=AF=D0=B3. =D0=B2 16:21, PG Bug reporting for= m <noreply@postgresql.org&= gt;:
The followi= ng bug has been logged on the website:

Bug reference:=C2=A0 =C2=A0 =C2=A0 19458
Logged by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Andrey Rachitskiy
Email address:=C2=A0 =C2=A0 =C2=A0 pl0h0yp1@gmail.com
PostgreSQL version: 14.22
Operating system:=C2=A0 =C2=A0Debian GNU/Linux 12 (bookworm)
Description:=C2=A0 =C2=A0 =C2=A0 =C2=A0

Description:
During fuzzing of the jsonb_path_exists_opr (operator jsonb @? jsonpath, a<= br> two-argument version of jsonb_path_exists()), a pathological query was
discovered that causes uncontrolled memory consumption, leading to OOM
Killer on PostgreSQL versions REL_14/15/16_STABLE.
On versions 17 and 18, the same query returns a proper error instead of
crashing the server.
This bug was found using AFL++ as a fuzzer and LibBlobStamper as a tool for=
creating syntactically correct arguments.

Reproduction:
Execute the following query:
```sql
select '[3472328296227680304, 3472328296227680304, 3472328296227680304,=
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
13558284848669739, 3472328296227668016, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328295419228208, 3472328296227680304,
3528904766546522246, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296328343600,
3472328296227680304, 3472328296227680299, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3470920921344127024, 3906362710315511856,
3472328296228075062, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472334893297446960, 3472328090069248816,
13511005849006128, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
3472328296227680304, 3472328296227680304, 3472328296227680304,
13563782407139376, 4337019423877509168]'::jsonb @? '(-$?(0 <
($"=E3=80=B0=E3=80=AD=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= " - $?(0 < $"=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0" - $?(0 + $ <
$"=E3=98=B0=E3=80=B0=E3=98=B6=E3=80=B0")."=E3=80=B0=E3=80=B0= =E3=80=B0=E3=80=B0")."=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0=E3=80=B0=E3=80=B0") - 0?(+$ < $"=E3=80=B0
=E3=80=B0=E3=80=B0=E3=80=B0")."=E3=81=BB=E3=80=B0=E3=80=B0=E3=98= =B0")."=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B6=E3=80=B0=E3=80=B0=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= =E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= =E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0")'::jsonpath;
```

Expected result:
The query should return an error, as happens on versions 17 and 18:
ERROR:=C2=A0 could not find jsonpath variable "=E3=80=B0=E3=80=AD=E3= =80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80= =B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0= =E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0=E3=80=B0"

Actual result (14, 15, 16):
=C2=A0 - Memory consumption grows until the kernel kills the postgres proce= ss via
OOM Killer
=C2=A0 - Client loses connection:
=C2=A0 =C2=A0 =C2=A0 =C2=A0server closed the connection unexpectedly
=C2=A0 =C2=A0 =C2=A0 =C2=A0This probably means the server terminated abnorm= ally
=C2=A0 =C2=A0 =C2=A0 =C2=A0before or while processing the request.

Kernel log:
516294.487767] Out of memory: Killed process 1135405 (postgres)
total-vm:13521932kB, anon-rss:9170792kB, file-rss:92kB, shmem-rss:1848kB, UID:1002 pgtables:26176kB oom_score_adj:0

--
Regards,
Andrey Rachitskiy
Postgres Professional


--00000000000046c562064fe46b16-- --00000000000046c563064fe46b18 Content-Type: application/octet-stream; name="jsonpath-fix-null-comparison.patch" Content-Disposition: attachment; filename="jsonpath-fix-null-comparison.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_mo78go770 ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL3V0aWxzL2FkdC9qc29ucGF0aF9leGVjLmMgYi9zcmMv YmFja2VuZC91dGlscy9hZHQvanNvbnBhdGhfZXhlYy5jCmluZGV4IDEwZWM2NmM2MjkzLi4zNDQy MDg0OWVhYyAxMDA2NDQKLS0tIGEvc3JjL2JhY2tlbmQvdXRpbHMvYWR0L2pzb25wYXRoX2V4ZWMu YworKysgYi9zcmMvYmFja2VuZC91dGlscy9hZHQvanNvbnBhdGhfZXhlYy5jCkBAIC0yMTI4LDE0 ICsyMTI4LDE1IEBAIGdldEpzb25QYXRoVmFyaWFibGUoSnNvblBhdGhFeGVjQ29udGV4dCAqY3h0 LCBKc29uUGF0aEl0ZW0gKnZhcmlhYmxlLAogCUpzb25iVmFsdWUJdG1wOwogCUpzb25iVmFsdWUg KnY7CiAKLQlpZiAoIXZhcnMpCi0JewotCQl2YWx1ZS0+dHlwZSA9IGpidk51bGw7Ci0JCXJldHVy bjsKLQl9Ci0KIAlBc3NlcnQodmFyaWFibGUtPnR5cGUgPT0ganBpVmFyaWFibGUpOwogCXZhck5h bWUgPSBqc3BHZXRTdHJpbmcodmFyaWFibGUsICZ2YXJOYW1lTGVuZ3RoKTsKKworCWlmICghdmFy cykKKwkJZXJlcG9ydChFUlJPUiwKKwkJCShlcnJjb2RlKEVSUkNPREVfVU5ERUZJTkVEX09CSkVD VCksCisJCQkgZXJybXNnKCJjb3VsZCBub3QgZmluZCBqc29ucGF0aCB2YXJpYWJsZSBcIiVzXCIi LAorCQkJCQlwbnN0cmR1cCh2YXJOYW1lLCB2YXJOYW1lTGVuZ3RoKSkpKTsKKwogCXRtcC50eXBl ID0gamJ2U3RyaW5nOwogCXRtcC52YWwuc3RyaW5nLnZhbCA9IHZhck5hbWU7CiAJdG1wLnZhbC5z dHJpbmcubGVuID0gdmFyTmFtZUxlbmd0aDsK --00000000000046c563064fe46b18--