public inbox for [email protected]  
help / color / mirror / Atom feed
From: =?ISO-8859-1?B?emVuZ21hbg==?= <[email protected]>
To: =?ISO-8859-1?B?YXNzYW0yNTg=?= <[email protected]>
Cc: =?ISO-8859-1?B?cGdzcWwtaGFja2Vycw==?= <[email protected]>
Cc: =?ISO-8859-1?B?SnVud2FuZyBaaGFv?= <[email protected]>
Cc: =?ISO-8859-1?B?QXNodXRvc2ggQmFwYXQ=?= <[email protected]>
Cc: =?ISO-8859-1?B?UGV0ZXIgRWlzZW50cmF1dA==?= <[email protected]>
Subject: rewriteGraphTable: Fix missing RTEs in FROM clause by setting inFromCl=true
Date: Fri, 20 Mar 2026 22:15:57 +0800
Message-ID: <[email protected]> (raw)

> > Would you consider adding this to the commitfest?
> 
> Hi Henson,
> 
> Thank you for reminding me.
> ```
> https://commitfest.postgresql.org/patch/6602/
> ```
> I discovered that due to my incorrect operation, the two themes were merged together, which is quite embarrassing.

Hi,

Sorry to bother everyone, I forgot to update the pg_overexplain.out file in version 0001. 
Also, I'm starting a new topic here to avoid interfering with testing on another topic.

```
https://www.postgresql.org/message-id/flat/tencent_40CF78D67AF8FCFA50C453A7%40qq.com#7cace1a418dcbab...
```

--
regards,
Man Zeng

Attachments:

  [application/octet-stream] 0002-Correcting-the-value-of-rte-inFromCl-in-SQL-PGQ.patch (2.1K, 2-0002-Correcting-the-value-of-rte-inFromCl-in-SQL-PGQ.patch)
  download | inline diff:
From c4ec73409f09aebdc43c2a9820792ad432be0557 Mon Sep 17 00:00:00 2001
From: Man Zeng <[email protected]>
Date: Fri, 20 Mar 2026 21:59:25 +0800
Subject: [PATCH] Correcting the value of rte->inFromCl in (SQL/PGQ)

Setting it to false in the commit statement 2f094e7ac691abc9d2fe0f4dcf0feac4a6ce1d9c is incorrect.

It should actually be set to true to ensure an equivalent SQL statement is obtained.
---
 contrib/pg_overexplain/expected/pg_overexplain.out | 4 ++--
 src/backend/rewrite/rewriteGraphTable.c            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/pg_overexplain/expected/pg_overexplain.out b/contrib/pg_overexplain/expected/pg_overexplain.out
index 05c6686d677..f4ad26df1ae 100644
--- a/contrib/pg_overexplain/expected/pg_overexplain.out
+++ b/contrib/pg_overexplain/expected/pg_overexplain.out
@@ -649,14 +649,14 @@ SELECT * FROM GRAPH_TABLE (vegetables_graph MATCH (v1 IS vegetables) WHERE v1.ge
  RTI 3 (subquery):
    Eref: unnamed_subquery (name)
    Lateral: true
- RTI 4 (relation):
+ RTI 4 (relation, in-from-clause):
    Subplan: unnamed_subquery
    Eref: daucus (id, name, genus)
    Relation: daucus
    Relation Kind: relation
    Relation Lock Mode: AccessShareLock
    Permission Info Index: 2
- RTI 5 (relation):
+ RTI 5 (relation, in-from-clause):
    Subplan: unnamed_subquery_1
    Eref: brassica (id, name, genus)
    Relation: brassica
diff --git a/src/backend/rewrite/rewriteGraphTable.c b/src/backend/rewrite/rewriteGraphTable.c
index 06f2f3442d8..d43704ef233 100644
--- a/src/backend/rewrite/rewriteGraphTable.c
+++ b/src/backend/rewrite/rewriteGraphTable.c
@@ -498,7 +498,7 @@ generate_query_for_graph_path(RangeTblEntry *rte, List *graph_path)
 		 */
 		rel = table_open(pe->reloid, AccessShareLock);
 		pni = addRangeTableEntryForRelation(make_parsestate(NULL), rel, AccessShareLock,
-											NULL, true, false);
+											NULL, true, true);
 		table_close(rel, NoLock);
 		path_query->rtable = lappend(path_query->rtable, pni->p_rte);
 		path_query->rteperminfos = lappend(path_query->rteperminfos, pni->p_perminfo);
-- 
2.45.2



view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: rewriteGraphTable: Fix missing RTEs in FROM clause by setting inFromCl=true
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox