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 1x0xXa-004uCn-1J for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2026 08:38:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x0xXY-00GUps-0X for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2026 08:38:52 +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 1x0xXX-00GUpk-2o for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2026 08:38:51 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x0xXW-00000003H0G-05Da for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2026 08:38:51 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-8485b358552so3138908b3a.2 for ; Mon, 31 Aug 2026 01:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788165529; x=1788770329; 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=ykOFfEp1lg+wobgcMV+1S5QZ3uoz91rhzlih2e6jxPw=; b=YInqquCvJgCQbxWnNPSqNN1cgRtjpUf7uzTxAPgy4RNs+w8/5rj5qg8ezCajPz/qSl GR46ayOTL+XHA28IFIgGCWxRbp8fadlgknQy3EqbmHT2cIM7/7r8ti810ffjlzhcth2o vCYTcUJv8FDjr6Yzmfn95PLfrO4AWyvZ00dgf6UHM8+Q4Wsh9ivgx2kO8sJEy7EEPyKO NZ8NQ/UzXK6lgpbTrPRIsfFprgfSSIiyAQhwsClEnjzysIFbMsh3g56MCsL5s0dejHzM iY64eepSg0TZJdhFcBonALrWIzgxUK4LnLsMeIKq+uIeeakEMzwbETRJ/wqiA6li3jzn DsbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788165529; x=1788770329; 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=ykOFfEp1lg+wobgcMV+1S5QZ3uoz91rhzlih2e6jxPw=; b=AtsgqGWz3AWZyh8BX9Yj+1jBAGhL7WY4Ggx5rw2biUWLwwUVM3c150eUmJO7eExfBl sTwXmsS03KXnwF9i/DGk4MOXAUR6Zk+z/9Cz8BARtiIjjztnYb9eKGbxd9IKWYjWF2+T x6gEbY3ktlEIjwXsDWx184ZHdCPLnrQjvs40GYiNnn1HyGltnjYO1YRH8EwBHuoWVLVC yRc5mMTyrRPjCQ2mxiVlZ+u3g06RvfzF6KHcXxYso93cmIW3DuZLdBmDtUkkHhgjGsEM 1zSPB7eOpPOIBwQxRugMpgl1qINHEFBHFt1gWr/jNcpytyT9GWWxU+HAA2VAixcp1HmI wOnA== X-Gm-Message-State: AFuF++nLnmOg76t7F9RuhSYcGy3ZDQMNDajz33Qho6Xhq0oWZZNG5wu+ 3bTfZmZM1H5wFnHBnvjGyQ9YYk4hCb9VG1r4QUjGcdcaWlXXPJkF3/0p X-Gm-Gg: AR+sD10pSQVn9GLOsgeuDnd/3xHHdnwfYckUZAWxQe7+vfr1hCzPxoMMxLSdHOEqnda 0mgULU7U94OEum5/8ZyFuElUkAT9puJEzNINTMoLt1JjzrrO9r+SEOwRv2pNWhzc/odYhEmKsfa +17XsEp6hSq+0DW+mh/C05O6HfxjZ4TSmjmZwcb/o09AKa+PruEQczMKh6+BVKBeyl0jKlTstT/ GK/AX9QlJBgySFfkDlROr0gU6bciW6Wzj362Pj5w7Yp7n0WrFCz/6CBKsvD5wHqyhE0OwRQPvFF KHF7seJEznlEauJV5jpB4MG9OTZkMpdBgunQdWjJ7qcifEHTi3+74mALSmE4KgUKbSusFffuMna bVe0ZRDjGEb0DyBDbNM6kkZTydC7eoTEY9s6Ad8eIG5R6e/TIvgiOqMmK47kprKO4JAxIILUuwf +xmZgWGA18ewx8Tcdz1y1UWZtNteoH38Gahj0K3oP3kO0xz9nvoO+5LjzgDRDt+G50/VxD9w== X-Received: by 2002:a05:6a00:3319:b0:851:fb36:a701 with SMTP id d2e1a72fcca58-8562879115cmr42572778b3a.7.1788165528902; Mon, 31 Aug 2026 01:38:48 -0700 (PDT) Received: from smtpclient.apple ([185.135.79.161]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cc1f36aff95sm3789323a12.20.2026.08.31.01.38.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Aug 2026 01:38:48 -0700 (PDT) Content-Type: text/plain; charset=us-ascii 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 16:38:12 +0800 Cc: PostgreSQL Hackers , Peter Eisentraut , Ashutosh Bapat Content-Transfer-Encoding: quoted-printable Message-Id: <6CC41338-C5EC-4AA0-8D8E-7C61DE8C768F@gmail.com> References: 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 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 > --=20 > Regards, > Ewan Young > The patch looks good to me. As this is a v19 bug, it might be worth = noting in the Open Items list. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/