pgsql: Remove Value node struct - Mailing list pgsql-committers

From Peter Eisentraut
Subject pgsql: Remove Value node struct
Date
Msg-id E1mOE0p-0005s5-Bt@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Make shared_memory_size a preset option
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Fix _equalA_Const