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 1x1EKw-0053Md-2Y for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Sep 2026 02:34:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x1EKv-003H8s-2A for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Sep 2026 02:34:57 +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 1x1EKv-003H75-11 for pgsql-hackers@lists.postgresql.org; Tue, 01 Sep 2026 02:34:57 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x1EKs-00000002IaR-0qR0 for pgsql-hackers@lists.postgresql.org; Tue, 01 Sep 2026 02:34:56 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5b4ab4b4179so1810138e87.0 for ; Mon, 31 Aug 2026 19:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1788230091; cv=none; d=google.com; s=arc-20260327; b=eXNArgSge30CHnd0yYSc3ZulLECFUOZ1CsSNQGmdTJoe3IIIrRMezq5vBMKjrsBUZJ XIFh9nVzLbnUXempChif+5se4ILrp9LkqvdhrVTZe9V0cs3ClhpuOgnndWriioumHdg0 T+xZ71WFpJ9p1G8k4v8S42rvBjr7mqJ4oG+BqV9aMSTG6BMIPGhcw0fjTR940LjuTCGx ESyXoqq+sBScm7QgAnoVTBcPxX/HDTh2hwJO/xJt61v7vHgVN87hIPB2KWyahYC2c05d a4tqDSbdzrIEjSkKJd38OcMwqKB5ABrCAZUG1I9XUpLnoNlP99uiyMt5/+dsH5zpUwFd C1wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3FpRCmOqvfk55STvibj5UdePjN0E0vfqaTuDZXNx3uc=; fh=IRYbL3OftrFyL/Vd5xm1Jq7ukd5ydvuF3Skqw5YgPag=; b=b6dV46i3IWQrmkXy1fCN2pyalw9voA5rnMzicsLpeHRi1ylfn9MG5Ut0M9zRjrvoxp Do2xnwKV7QjZHwzMSSWiMXwopUuMGPavgMu4wSoslwhGEZulWW4f3evmKD3GhsyPrm8P w+fkRXCWVXa4Pe26NpNqpWbM2ETUTjASyHAYPhcaMEgaexGYxCX8Bp6iXZqkLYx/eiKZ XRL5wNDd8bfSvuYLWp+N7cxu012qwgLQ1GcQ5St9DvFHxLr39BC0CwU5HDa2JxSbB/yj m82jS0iGpCkv7rzsZ0SLXm65Tol5RxdJnkVar70fN2GIZKvghqiNhBjAVrVgn4DDgnes i9Mw==; 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=1788230091; x=1788834891; darn=lists.postgresql.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=3FpRCmOqvfk55STvibj5UdePjN0E0vfqaTuDZXNx3uc=; b=MIN+YvsAewVmnuFQzynBc/D/2wJJIcLRu7OUWjJ9PRRSDP64pRhFlmgLQXKDoTPkBj N79NvjPYIABL7diChgC3nL+p2Pt9iOoagJJ0OArHVNrDaLqdkfhaPFpQFy1FHys682uf hxZoiPSS83HOPu8p05PKasTIPcuYyhsrt1pXllgiHHyaKl7ZjTGBjQvecTCH7YdcLv5z glSfAM1u9fJOrLekgoRnwTwLDX0KBWNRECEsRRwVChud9exPtYhoTQdasjQ59zSQkyd3 kkWyW5+lrjl3Zna/nsqUj1HJGaf+OMTGpxgpyOw9TpQjOkqJ0gb2lLKUKukMH9NCUn3L lfTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788230091; x=1788834891; h=content-transfer-encoding:content-type: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 :content-type; bh=3FpRCmOqvfk55STvibj5UdePjN0E0vfqaTuDZXNx3uc=; b=XuK4xh689unr1UeEYPo02+C0QckXB7ifwVy1d01B+8D95TdPek55UDsp9Bo31Oswdl Mo3fyZOdtniAzQlCUUF/055toVIsiGG5iZt9ObwQXCQ5sdt5DPDohh13pDScK8L8UTZT D+fsbw6e9bjDNXcY2M2wdgZfzvmyA6qk/Fzn2cF/PkaFSRD9baAxloO+64jEG7umaTIt yQwm7tc1iZ5wqkRZ6mo6bceKefQ/n1XAe6cMRdNH8v7u0aOeDXi8sVSoLIbx8HX0ywyQ SQthpLdUasNETLhrzGqc/C7Ke308MaFz+oz3pev+1F+Zi7OjEbP2FKbpVy2Sd8NOAa1e Mfpg== X-Gm-Message-State: AFuF++nwcH58De32iupDCveQp76w6VRfS5Ddea8RS8p0VpSowuu5cCfx mVo5GEXITxfg4Gdvepr07sgxpmE125fCVVROkDmSBATRZnruDgoZY1tN3Cl2HIOWc6w0dVBQMCT CYygB6mpNjvIToRjuI/+amaaLk37ggVazN7ih X-Gm-Gg: AYBFou3vknH4pFlCFS+lPZYNZX66Iqg+spbfOzEtuYkJoOTZv6sCuUrLBdQBcqSSNlz ZIMhE1VzCqkqW/tRJXDyUZlgVm/RyC2/RQ7s+ZytCjYdy21vyRMX2JYlKoWnA57YG/4yKDGUE9C HF9Qu6xawmnsMX1td4//LJuMDNqP5IF0nb97A7mRSEmAGPPOJZmspzY5lzinaw4f4lCd7nnD7Ln ucEUgnxJrPYB9XvzAS3GlyqThQS9VFK3GB0n328+FGOYeBOEbv/VaS6oWd/73n1iefgjIELk+Ns WO1kQDaSM0D7MHhpokWaXyQXprgnT6F+jWTfiLvHziop0QL0MvPg2+YB3jDczprbZAqf7WNYa/G 8vcVJHSwKkXTKGY/PkzDVCz3Oq8NpY0eoHP42DxogURwL X-Received: by 2002:a05:6512:3baa:b0:5b0:197b:9827 with SMTP id 2adb3069b0e04-5b5fe058e29mr1651941e87.3.1788230091077; Mon, 31 Aug 2026 19:34:51 -0700 (PDT) MIME-Version: 1.0 References: <6CC41338-C5EC-4AA0-8D8E-7C61DE8C768F@gmail.com> <3AE204BD-2682-4893-A100-88719E5CCDBB@gmail.com> In-Reply-To: <3AE204BD-2682-4893-A100-88719E5CCDBB@gmail.com> From: Ewan Young Date: Tue, 1 Sep 2026 10:34:38 +0800 X-Gm-Features: AcwNN1WMrdASWAUY7bxVOaFJNExm5J6CbAwbL2EkZRfMiUsl6JLc9NWGYY8aJLk Message-ID: Subject: Re: GRAPH_TABLE pattern WHERE clause is not coerced to boolean To: Chao Li Cc: PostgreSQL Hackers , Peter Eisentraut , Ashutosh Bapat Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thanks for adding it! On Mon, Aug 31, 2026 at 7:27=E2=80=AFPM Chao Li wr= ote: > > > > > On Aug 31, 2026, at 18:08, Ewan Young wrote: > > > > Thanks for the review! > > > > On Mon, Aug 31, 2026 at 4:38=E2=80=AFPM Chao Li wrote: > >> > >> > >> > >>> On Aug 31, 2026, at 15:32, Ewan Young wrote: > >>> > >>> Hi > >>> > >>> The WHERE clauses inside a GRAPH_TABLE pattern -- both the element-le= vel > >>> one (MATCH (c IS customers WHERE ...)) and the graph-pattern-level on= e > >>> (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: > >>> > >>> 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)); > >>> > >>> select * from graph_table (g match (c is customer where c.name) > >>> columns (c.id)); > >>> id > >>> ---- > >>> 1 > >>> 3 > >>> (2 rows) > >>> > >>> 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 > >>> > >>> ERROR: argument of WHERE must be type boolean, not type text > >>> > >>> 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. > >>> > >>> -- > >>> Regards, > >>> Ewan Young > >>> > >> > >> The patch looks good to me. As this is a v19 bug, it might be worth no= ting in the Open Items list. > > > > Agreed -- I don't have wiki edit access though; could someone add it > > under "Open Issues"? > > > > I just helped add the item. > > Best regards, > -- > Chao Li (Evan) > HighGo Software Co., Ltd. > https://www.highgo.com/ > > > > --=20 Regards, Ewan Young