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 1wFnsD-005ZIO-1J for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2026 06:49:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFnsC-0001Yk-2A for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Apr 2026 06:49:16 +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 1wFnsC-0001Yc-1F for pgsql-hackers@lists.postgresql.org; Thu, 23 Apr 2026 06:49:16 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFns6-00000002bWc-2WEx for pgsql-hackers@lists.postgresql.org; Thu, 23 Apr 2026 06:49:16 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-488af9fdaa7so37607755e9.1 for ; Wed, 22 Apr 2026 23:49:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776926949; cv=none; d=google.com; s=arc-20240605; b=BVgmlY4cY16XgvE45ZxnlYW1xuZMrIeaqa6BhgaH9zh+rD/bQ/z4Fsgz63L6TVRyUG uAH7yueW3uVuRg0VkrcJvalz7VoOk4sHn3hUVhTJfty6wXddlW+WCeTUn/3EFXv48F/W W5kSCweAvxiMkZp7N7YNPas0dWZ9azhdVcbXpKL4eeayol6LETquLLhkO6XitaP7nx4p a2KoOTkAII/pBFQ51WGa6Tqek6Ehkrz47ueOWJgOrLzGLf6i/iC8l/qQaQWSKXHTFHxM nRnHZOOtDQwMPh/kpBCgXsX6u4jVqfyIcQqXW33rnixHOMK770/zmheZD5UaB8qEnVp7 y/0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=HHzuQ5ijdq9I26AUXhdVOlgOFO7vzPauDlqbl8cceq4=; fh=PDhzRmLFhJQgKl2kpY6iqaoiggk+rKjB8rXL7ERgOws=; b=RMkC+Xa5oocWCNZpzvnfWt5yrdRkf6YRMyxFO7C2zBjK2qWggX40IxjnuWuE+gRjJ/ QgNiZkrDS53rcKNDuI/qRFlCHpL0EAWAikDGqwyyQ2uUHj4u1F00/Lqio9B6+Au6fYut VOWHT31AYtogTOQwUWCL1ZfaPn3ZSVQNwcZg2f47nwdn9RJh4Ewopn58F+ok5t3AmV// sRC+jJ/O5dG29SAdD8AtCpr3ZtmM4wadIQbndvb+XYZf1lizGIljVaEWX8IMTtE+n7wn k0ZOhEteFU4a+2gLyA9/6tDgC8BS24HlgLLcbfPgZBvU3DZ6oBfBGiOY4Pr6eO12+ppI dEHw==; 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=1776926949; x=1777531749; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HHzuQ5ijdq9I26AUXhdVOlgOFO7vzPauDlqbl8cceq4=; b=rWPM/ewKrVH5DLadnyFGnM6wGVU96FfwWWeVFO0sSAZg5gylY4myZBAaTJYg240LS1 6l1B7OEyGORXzmV/L/e1SPpodgqxyqI/4uZVsS95E/0AhX2QGtYKtt3LOlP+6YQ5JU1n OapCh/01HMotmywB3L82qPq5vZPNmFedbwA5/V4DJU1hU2B92cv0rfJeWzH+PBfa4jTD eiNUeV23WHE8N3LUv/VKgj0CUR+uppcIEIvX9DjiPW6BTo2hPdqRR2CsjahK2GuaGx9y 3eNvrlbTX/Gn8Z7RonrodXmWbI1X9DtKdwLrZcCwFpaDYBt76rpss9QsLflCaMYy92PB eJWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776926949; x=1777531749; h=content-transfer-encoding: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=HHzuQ5ijdq9I26AUXhdVOlgOFO7vzPauDlqbl8cceq4=; b=H+/U6Ze0Vw23x/KCroQ7AOQY7i4Vz+IEOb36pph9+x/dctEQHIsRVN0/IjeIYRvN6C 9Y0a/B9ibcXv9flcbokLsB3ZsDFKGGLGXPb8I7qcJ/LtKEvJpQqlBlvbgAFHkR5JpgzX evxX3G/wHs8csj4XIY9bcRh0Ap/wybcmRR3/YB40opj5cOwMYRGoyN9S/Po1Bks9oJwC RhqKyGMEgPyttrMfqf+WRi9EcLeqU0mj5TvMyzwS91HaIfX5b/6GVQlcStEdAytt1BVL hNglOsdXka8Ab/ruefq7fXycx8kgO/UbiuJNFyEg9pb/yFL8lc3uf2hB/7lcYFRlc5MY ktNg== X-Gm-Message-State: AOJu0Yx+4z1QrI/QDuNxy5MrudCPKuddXK8X6cDDZ4JKkpCEj5s7XbqB yEYrt+G0SkiqxJtzo5zHV7pMf8ddIIuD3E+t/eMk05YDmALFJgylWJVIPfE8XRUzI/klmDQ6Gpi sLhPJggi2cPt6b2Z/LQYBnG/zdKPrBQ8= X-Gm-Gg: AeBDievNSOjzNaeHSMqxhnJRjWxD3R1bkK7/llcNgvWf+k8xfWyKn3B6P8et8GhwHDi a3BtkqBj+fC230ZcEn6w835BPg2ZvEnFwPPISzheFAKe4oMi+uBUOMltc/5YNqpSx1ffndC/NFZ RcAGEAVBsPN1NwD0rB5uFd1KOfcPtoLwCfOu/w2NvOLOEMruiHmdMBMkfTOcgembEsrv7KxP1I9 3pybynXM905NmGPKlKFvod0K6xTQLkwHu0j3GaUnRuUqD31dbPVtC7d+RWXtfN6U4sGQG6k3M1r PeweKBZB/8JuQUzrFPeW0Wq8mey4xzr5KrFHYgV+1k3la8hCqDt/TkGroKRGZQ== X-Received: by 2002:a05:600c:154e:b0:488:aa3d:faca with SMTP id 5b1f17b1804b1-488fb771a4emr312885055e9.18.1776926949242; Wed, 22 Apr 2026 23:49:09 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ashutosh Bapat Date: Thu, 23 Apr 2026 12:18:55 +0530 X-Gm-Features: AQROBzAySBrPmynY0n0E8aHIN75x16S_0vtt5WgdjBN2OfzCCGLgemAQBkyGOPI Message-ID: Subject: Re: [Patch]Add Graph* node support to expression_tree_mutator To: SATYANARAYANA NARLAPURAM Cc: PostgreSQL Hackers 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 On Tue, Apr 21, 2026 at 9:26=E2=80=AFPM SATYANARAYANA NARLAPURAM wrote: > > Hi hackers, > > expression_tree_mutator_impl() was missing case handlers for > T_GraphPattern, T_GraphElementPattern, and T_GraphPropertyRef. > The corresponding expression_tree_walker_impl() already handled > all three node types, but the mutator did not, causing an > "unrecognized node type: 106" error whenever a GRAPH_TABLE > subquery appeared in a HAVING clause. > > SELECT 1 FROM hv GROUP BY id > HAVING (SELECT COUNT(*) FROM GRAPH_TABLE(gh MATCH (a) COLUMNS (a.id AS x)= )) > 0; > SET > ERROR: unrecognized node type: 106 > > Attached a patch to address this. Thanks for the report and the patch. I first thought that the nodes needn't be part of the mutator since they will be rewritten into some other nodes. But in this case the mutator is being called from the transformation phase which does not rewrite these nodes. I also found that range_table_mutator_impl() invokes MUTATE on RangeTblEntry::graph_table and RangeTblEntry::graph_table_columns which contain these three nodes in their trees. So it seems like we forgot to handle these three nodes in expression_tree_mutator(). From the name of the function, I thought it only handles expressions (nodes which have Expr as their first member). In that case adding GraphElementPattern and GraphPattern should be handled somewhere else. But it seems the function also handles Node types as well (e.g. List, TableFunc). GraphPropertyRef has char *elvarname. Only the char * is copied by FLATCOPY but not the character string it's pointing to. That made me a bit uncomfortable because the mutated GraphPropertyRef would point to the old name. But it looks like that's how other node types are handled in that function. E.g. XmlExpr has member name which is also FLATCOPY'ed. So we are good. Why is MUTATE not called on GraphElementPattern::labelexpr and GraphElementPattern::quantifier? The test query is placed at the appropriate section in the file. I would try to fit the query in lesser lines by placing SELECT, FROM, GROUP BY on the same line. But that's more of a personal style. --=20 Best Wishes, Ashutosh Bapat