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 1x10Am-004vbX-0d for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2026 11:27:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x10Al-00HNOv-0W for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2026 11:27:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x10Ak-00HNOh-2p for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2026 11:27:30 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x10Ai-00000003I99-2vnG for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2026 11:27:30 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2d6efd73032so36007795ad.0 for ; Mon, 31 Aug 2026 04:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788175648; x=1788780448; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=rwgOucl0fLNcZijpIjGZTk5qzpgdwYABlAnna7xKUhk=; b=A26Ua8CpvH20qyE+VbUPc/gqtmPNcMOF3GFWP6EUYRyvzHnMAgIOhtPTGw5MeXEwJO w99rdHLwzWc3KFsujjrcfgs7HV7962v8L2y2PEbrgis10ZXbvA96Cb1aszS36CqDKDqs LF1lR+cyxkFXdM1QQeSpULnIg+zS2qP1ExUCvqovD3QFXkgWBj90hL617O2b+b8dh372 C2pC2Rg6+ujNGxQnRfK2yb5QH4cUxNXS1Im3BFlDJBJOJ5jdtEKK/JPYDNpTsRigviic VYr5m1liJe2Z3na9K60/MbFQUWwviRbP+3MGcJnYCfWQSvR+DzMD0IlZlue2bAPmuYI6 tQyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788175648; x=1788780448; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=rwgOucl0fLNcZijpIjGZTk5qzpgdwYABlAnna7xKUhk=; b=K2CsfIuydlrUMnWJ2WvockPNTd4NhcJQs1M3XgnO+OfFq3EtO53WpqTph8cpGy42LK gRBtTi429ISR61RBfTGg8lty61JutjJ/LtNZtB7eyXlhBhue5P1RbL/eNdM5f60CzTIA RLyRrlmzsTTHs3dvQjF5mRj8DZpJPsCcK5P0bFBtOydNE1O4/19om+1jwaQ4kblP8bJP XuUduJ02AqlCETIi02I0V7w7zAoej3bS4mgcps/hWjQOwDyAyhuUcVQi6K/ApStNh3g0 Wkp3X9dND6Yoi6aKoLZl++fuV1VLjMPNRx4OH1OKfEHLUMv55YDYXyzdberJq08FCwD6 d3Xw== X-Gm-Message-State: AFuF++nmAL8P9g7JxH0oDy4UPeXAvnhkaey30RzUW8arbuSTCYBOK9vB JkNZdoYx0y8WnyhpUKk8MvZqd9eFgKt161L/u6qfk1Gr44EIjTdzlQz+EDfrHg== X-Gm-Gg: AYBFou2XeO0x4QVah06OhvC2PPg/iOa8j3VQ+kyAPRmpwUghJG+22QI7WCI4FOuWrpz D7TfPkNR2vH7KEGIdObST2T0CP0EV7ycyYRyRSvhJhgtiP2ag3pXwaXkYs7hRk9HPW3OCboBfnE /SgwKLXTW6YKmDccldkWQd74m5Wcv4WNVQvrzHsiKwCILIdvVyFNqtYCkph7uSNXbQszDUybEbB 1YFzmuNHmNf+DVdxE5p3bm9UD8E7bE3r3gQ8efOcUMdtO9pkxR2nJN1y5cLoIcc6Olxqh61dmq2 ZDaISqT/EPeRPqYCn8U5JXbgBDoum85ib7Cwq+dKJlre+waWqiIPUbLY2SeV1ICRbejrlfBID5L dKB1+a4sg7DWCkGRvMTvB6ZQoi6iQDbOak8Hx+31g6kgxfoMY2CPUmU3MtArquOCnM2IKRfBhOc tas8du41Sx86SaKN32M2Hl6gANRBjlDE2VgmFks2c1JqCBYTp4FCCeHDuSt4FK+KynVInwRQ== X-Received: by 2002:a17:902:d54f:b0:2cf:7db9:e13e with SMTP id d9443c01a7336-2d91af606e4mr61585125ad.3.1788175647739; Mon, 31 Aug 2026 04:27:27 -0700 (PDT) Received: from smtpclient.apple ([185.135.79.161]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d908fdaf86sm17925745ad.13.2026.08.31.04.27.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Aug 2026 04:27:27 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.700.51.1.1\)) Subject: Re: GRAPH_TABLE pattern WHERE clause is not coerced to boolean From: Chao Li In-Reply-To: Date: Mon, 31 Aug 2026 19:26:50 +0800 Cc: PostgreSQL Hackers , Peter Eisentraut , Ashutosh Bapat Content-Transfer-Encoding: quoted-printable Message-Id: <3AE204BD-2682-4893-A100-88719E5CCDBB@gmail.com> References: <6CC41338-C5EC-4AA0-8D8E-7C61DE8C768F@gmail.com> To: Ewan Young X-Mailer: Apple Mail (2.3864.700.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Aug 31, 2026, at 18:08, Ewan Young wrote: >=20 > Thanks for the review! >=20 > On Mon, Aug 31, 2026 at 4:38=E2=80=AFPM Chao Li = wrote: >>=20 >>=20 >>=20 >>> On Aug 31, 2026, at 15:32, Ewan Young wrote: >>>=20 >>> Hi >>>=20 >>> The WHERE clauses inside a GRAPH_TABLE pattern -- both the = element-level >>> one (MATCH (c IS customers WHERE ...)) and the graph-pattern-level = one >>> (MATCH ... WHERE ...) -- are transformed with a bare transformExpr() >>> and never go through coerce_to_boolean(). So a WHERE clause of any >>> type is accepted, and its raw datum is used as the qual: >>>=20 >>> create table customers (id int primary key, name text); >>> insert into customers values (1,'alice'),(2,null),(3,'carol'); >>> create property graph g >>> vertex tables (customers key (id) label customer properties (id, = name)); >>>=20 >>> select * from graph_table (g match (c is customer where c.name) >>> columns (c.id)); >>> id >>> ---- >>> 1 >>> 3 >>> (2 rows) >>>=20 >>> EXPLAIN shows "Filter: name". The never-null text pointer is always >>> taken as true, so the condition silently degenerates to roughly >>> "name IS NOT NULL": the NULL-name row disappears with no error. >>> Numeric quals are evaluated by bit pattern ("WHERE 1" is true, >>> "WHERE 0" is false), and even "WHERE row(1,2)" is accepted. The = same >>> clause outside GRAPH_TABLE gives the usual >>>=20 >>> ERROR: argument of WHERE must be type boolean, not type text >>>=20 >>> The attached patch routes both sites through transformWhereClause(), >>> like every other WHERE clause, and adds regression tests for the >>> element-level and pattern-level cases. make check passes. The code = is >>> the same in REL_19_STABLE, so v19 is affected as well. >>>=20 >>> -- >>> Regards, >>> Ewan Young >>> >>=20 >> The patch looks good to me. As this is a v19 bug, it might be worth = noting in the Open Items list. >=20 > Agreed -- I don't have wiki edit access though; could someone add it > under "Open Issues"? >=20 I just helped add the item. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/