pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Parse/analyze function renaming
Date: Fri, 04 Mar 2022 13:56:46 +0000
Message-ID: <E1nQ8QH-000sUj-H1@gemulon.postgresql.org> (raw)

Parse/analyze function renaming

There are three parallel ways to call parse/analyze: with fixed
parameters, with variable parameters, and by supplying your own parser
callback.  Some of the involved functions were confusingly named and
made this API structure more confusing.  This patch renames some
functions to make this clearer:

parse_analyze() -> parse_analyze_fixedparams()
pg_analyze_and_rewrite() -> pg_analyze_and_rewrite_fixedparams()

(Otherwise one might think this variant doesn't accept parameters, but
in fact all three ways accept parameters.)

pg_analyze_and_rewrite_params() -> pg_analyze_and_rewrite_withcb()

(Before, and also when considering pg_analyze_and_rewrite(), one might
think this is the only way to pass parameters.  Moreover, the parser
callback doesn't necessarily need to parse only parameters, it's just
one of the things it could do.)

parse_fixed_parameters() -> setup_parse_fixed_parameters()
parse_variable_parameters() -> setup_parse_variable_parameters()

(These functions don't actually do any parsing, they just set up
callbacks to use during parsing later.)

This patch also adds some const decorations to the fixed-parameters
API, so the distinction from the variable-parameters API is more
clear.

Reviewed-by: Nathan Bossart <bossartn@amazon.com>
Discussion: https://www.postgresql.org/message-id/flat/c67ce276-52b4-0239-dc0e-39875bf81840@enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/791b1b71da35d9d4264f72a87e4078b85a2fcfb4

Modified Files
--------------
src/backend/catalog/pg_proc.c        |  2 +-
src/backend/commands/copyto.c        |  2 +-
src/backend/commands/extension.c     |  2 +-
src/backend/commands/schemacmds.c    |  2 +-
src/backend/commands/tablecmds.c     |  2 +-
src/backend/commands/view.c          |  2 +-
src/backend/executor/functions.c     |  2 +-
src/backend/executor/spi.c           |  8 ++++----
src/backend/optimizer/util/clauses.c |  2 +-
src/backend/parser/analyze.c         | 10 +++++-----
src/backend/parser/parse_param.c     |  8 ++++----
src/backend/parser/parse_utilcmd.c   |  2 +-
src/backend/tcop/postgres.c          | 17 +++++++++--------
src/backend/utils/cache/plancache.c  |  4 ++--
src/include/parser/analyze.h         |  4 ++--
src/include/parser/parse_param.h     |  6 +++---
src/include/tcop/tcopprot.h          |  6 +++---
17 files changed, 41 insertions(+), 40 deletions(-)



Message-ID: <E1nQ8QH-000sUj-H1@gemulon.postgresql.org>
Permalink:  ../E1nQ8QH-000sUj-H1@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nQ8QH-000sUj-H1@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: peter@eisentraut.org
  Subject: Re: pgsql: Parse/analyze function renaming
  In-Reply-To: <E1nQ8QH-000sUj-H1@gemulon.postgresql.org>
  References: <E1nQ8QH-000sUj-H1@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