pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor parser's generation of Var nodes.
Date: Thu, 26 Dec 2019 16:20:21 +0000
Message-ID: <E1ikVs5-0006df-Fw@gemulon.postgresql.org> (raw)

Refactor parser's generation of Var nodes.

Instead of passing around a pointer to the RangeTblEntry that
provides the desired column, pass a pointer to the associated
ParseNamespaceItem.  The RTE is trivially reachable from the nsitem,
and having the ParseNamespaceItem allows access to additional
information.  As proof of concept for that, add the rangetable index
to ParseNamespaceItem, and use that to get rid of RTERangeTablePosn
searches.

(I have in mind to teach the parser to generate some different
representation for Vars that are nullable by outer joins, and
keeping the necessary information in ParseNamespaceItems seems
like a reasonable approach to that.  But whether that ever
happens or not, this seems like good cleanup.)

Also refactor the code around scanRTEForColumn so that the
"fuzzy match" stuff does not leak out of parse_relation.c.

Discussion: https://postgr.es/m/26144.1576858373@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b541e9accb28c90656388a3f827ca3a68dd2a308

Modified Files
--------------
src/backend/parser/analyze.c        |  10 +-
src/backend/parser/parse_clause.c   |  23 ++-
src/backend/parser/parse_expr.c     | 105 ++++++------
src/backend/parser/parse_func.c     |  12 +-
src/backend/parser/parse_node.c     |  21 ---
src/backend/parser/parse_relation.c | 314 ++++++++++++++++++++++--------------
src/backend/parser/parse_target.c   |  85 +++++-----
src/include/parser/parse_node.h     |   8 +-
src/include/parser/parse_relation.h |  43 ++---
9 files changed, 332 insertions(+), 289 deletions(-)



Message-ID: <E1ikVs5-0006df-Fw@gemulon.postgresql.org>
Permalink:  ../E1ikVs5-0006df-Fw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ikVs5-0006df-Fw@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Refactor parser's generation of Var nodes.
  In-Reply-To: <E1ikVs5-0006df-Fw@gemulon.postgresql.org>
  References: <E1ikVs5-0006df-Fw@gemulon.postgresql.org>

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

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