From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove Value node struct
Date: Thu, 09 Sep 2021 06:58:19 +0000
Message-ID: <E1mOE0p-0005s5-Bt@gemulon.postgresql.org> (raw)
Remove Value node struct
The Value node struct is a weird construct. It is its own node type,
but most of the time, it actually has a node type of Integer, Float,
String, or BitString. As a consequence, the struct name and the node
type don't match most of the time, and so it has to be treated
specially a lot. There doesn't seem to be any value in the special
construct. There is very little code that wants to accept all Value
variants but nothing else (and even if it did, this doesn't provide
any convenient way to check it), and most code wants either just one
particular node type (usually String), or it accepts a broader set of
node types besides just Value.
This change removes the Value struct and node type and replaces them
by separate Integer, Float, String, and BitString node types that are
proper node types and structs of their own and behave mostly like
normal node types.
Also, this removes the T_Null node tag, which was previously also a
possible variant of Value but wasn't actually used outside of the
Value contained in A_Const. Replace that by an isnull field in
A_Const.
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/5ba6bc5b-3f95-04f2-2419-f8ddb4c046fb@enterprisedb.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/639a86e36aaecb84faaf941dcd0b183ba0aba9e9
Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c | 12 ++--
src/backend/catalog/namespace.c | 4 +-
src/backend/catalog/objectaddress.c | 6 +-
src/backend/catalog/pg_enum.c | 2 +-
src/backend/commands/copy.c | 5 +-
src/backend/commands/define.c | 9 +--
src/backend/commands/tsearchcmds.c | 4 +-
src/backend/executor/nodeTableFuncscan.c | 2 +-
src/backend/nodes/README | 2 +-
src/backend/nodes/copyfuncs.c | 107 ++++++++++++++++++-------------
src/backend/nodes/equalfuncs.c | 55 +++++++++-------
src/backend/nodes/nodeFuncs.c | 1 -
src/backend/nodes/outfuncs.c | 93 ++++++++++++++-------------
src/backend/nodes/value.c | 32 ++++-----
src/backend/parser/gram.y | 97 +++++++++++++---------------
src/backend/parser/parse_clause.c | 17 +++--
src/backend/parser/parse_cte.c | 4 +-
src/backend/parser/parse_expr.c | 13 ++--
src/backend/parser/parse_node.c | 50 ++++++++-------
src/backend/parser/parse_relation.c | 6 +-
src/backend/parser/parse_type.c | 14 ++--
src/backend/parser/parse_utilcmd.c | 4 +-
src/backend/utils/adt/oid.c | 2 +-
src/backend/utils/adt/ruleutils.c | 2 +-
src/backend/utils/misc/guc.c | 3 +-
src/include/nodes/nodes.h | 2 -
src/include/nodes/parsenodes.h | 66 +++++++++++--------
src/include/nodes/primnodes.h | 6 +-
src/include/nodes/value.h | 87 ++++++++++++++-----------
src/include/parser/parse_node.h | 3 +-
30 files changed, 373 insertions(+), 337 deletions(-)
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: Remove Value node struct
In-Reply-To: <E1mOE0p-0005s5-Bt@gemulon.postgresql.org>
References: <E1mOE0p-0005s5-Bt@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