pgsql: Parse/analyze function renaming

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Parse/analyze function renaming
Date: 2022-03-04 13:56:46
Message-ID: E1nQ8QH-000sUj-H1@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)amazon(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/c67ce276-52b4-0239-dc0e-39875bf81840(at)enterprisedb(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-03-04 18:24:12 pgsql: Fix pg_regress to print the correct postmaster address on Window
Previous Message Peter Eisentraut 2022-03-04 08:19:53 pgsql: psql: Make SSL info display more compact