]> granicus.if.org Git - postgresql/commit
Improve castNode notation by introducing list-extraction-specific variants.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 10 Apr 2017 17:51:29 +0000 (13:51 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 10 Apr 2017 17:51:53 +0000 (13:51 -0400)
commit8f0530f58061b185dc385df42e62d78a18d4ae3e
tree63d038ae4012dcdcff3b556dde4c654959f8448e
parent56dd8e85c40fef3e3c2c10afa186ee30416ec507
Improve castNode notation by introducing list-extraction-specific variants.

This extends the castNode() notation introduced by commit 5bcab1114 to
provide, in one step, extraction of a list cell's pointer and coercion to
a concrete node type.  For example, "lfirst_node(Foo, lc)" is the same
as "castNode(Foo, lfirst(lc))".  Almost half of the uses of castNode
that have appeared so far include a list extraction call, so this is
pretty widely useful, and it saves a few more keystrokes compared to the
old way.

As with the previous patch, back-patch the addition of these macros to
pg_list.h, so that the notation will be available when back-patching.

Patch by me, after an idea of Andrew Gierth's.

Discussion: https://postgr.es/m/14197.1491841216@sss.pgh.pa.us
65 files changed:
contrib/pg_stat_statements/pg_stat_statements.c
contrib/postgres_fdw/deparse.c
contrib/postgres_fdw/postgres_fdw.c
src/backend/catalog/objectaddress.c
src/backend/catalog/pg_proc.c
src/backend/commands/aggregatecmds.c
src/backend/commands/async.c
src/backend/commands/collationcmds.c
src/backend/commands/copy.c
src/backend/commands/createas.c
src/backend/commands/dropcmds.c
src/backend/commands/explain.c
src/backend/commands/extension.c
src/backend/commands/foreigncmds.c
src/backend/commands/functioncmds.c
src/backend/commands/matview.c
src/backend/commands/opclasscmds.c
src/backend/commands/portalcmds.c
src/backend/commands/prepare.c
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/commands/user.c
src/backend/commands/view.c
src/backend/executor/execExpr.c
src/backend/executor/execTuples.c
src/backend/executor/execUtils.c
src/backend/executor/functions.c
src/backend/executor/nodeAgg.c
src/backend/executor/nodeHashjoin.c
src/backend/executor/nodeLockRows.c
src/backend/executor/nodeModifyTable.c
src/backend/executor/nodeSubplan.c
src/backend/executor/spi.c
src/backend/nodes/nodeFuncs.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/plan/analyzejoins.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/orclauses.c
src/backend/optimizer/util/restrictinfo.c
src/backend/parser/analyze.c
src/backend/parser/gram.y
src/backend/parser/parse_collate.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_node.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_type.c
src/backend/parser/parse_utilcmd.c
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteHandler.c
src/backend/tcop/postgres.c
src/backend/tcop/pquery.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/cache/plancache.c
src/backend/utils/misc/guc.c
src/backend/utils/mmgr/portalmem.c
src/include/nodes/pg_list.h
src/pl/plpgsql/src/pl_exec.c