]> granicus.if.org Git - postgresql/commit
Create the infrastructure for planner support functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 9 Feb 2019 23:08:48 +0000 (18:08 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 9 Feb 2019 23:08:48 +0000 (18:08 -0500)
commit1fb57af92069ee104c09e2016af9e0e620681be3
tree8bb9db8431972a220f6bd6f8b13e663049172583
parent1a8d5afb0dfc5d0dcc6eda0656a34cb1f0cf0bdf
Create the infrastructure for planner support functions.

Rename/repurpose pg_proc.protransform as "prosupport".  The idea is
still that it names an internal function that provides knowledge to
the planner about the behavior of the function it's attached to;
but redesign the API specification so that it's not limited to doing
just one thing, but can support an extensible set of requests.

The original purpose of simplifying a function call is handled by
the first request type to be invented, SupportRequestSimplify.
Adjust all the existing transform functions to handle this API,
and rename them fron "xxx_transform" to "xxx_support" to reflect
the potential generalization of what they do.  (Since we never
previously provided any way for extensions to add transform functions,
this change doesn't create an API break for them.)

Also add DDL and pg_dump support for attaching a support function to a
user-defined function.  Unfortunately, DDL access has to be restricted
to superusers, at least for now; but seeing that support functions
will pretty much have to be written in C, that limitation is just
theoretical.  (This support is untested in this patch, but a follow-on
patch will add cases that exercise it.)

Discussion: https://postgr.es/m/15193.1548028093@sss.pgh.pa.us
41 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/keywords.sgml
doc/src/sgml/ref/alter_function.sgml
doc/src/sgml/ref/create_function.sgml
doc/src/sgml/xfunc.sgml
doc/src/sgml/xoper.sgml
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_depend.c
src/backend/catalog/pg_proc.c
src/backend/commands/functioncmds.c
src/backend/commands/proclang.c
src/backend/commands/typecmds.c
src/backend/optimizer/util/clauses.c
src/backend/parser/gram.y
src/backend/utils/adt/date.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/numeric.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/varbit.c
src/backend/utils/adt/varchar.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/t/002_pg_dump.pl
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/catalog/pg_proc.h
src/include/nodes/nodes.h
src/include/nodes/supportnodes.h [new file with mode: 0644]
src/include/parser/kwlist.h
src/include/utils/datetime.h
src/test/modules/test_ddl_deparse/expected/create_transform.out
src/test/modules/test_ddl_deparse/sql/create_transform.sql
src/test/regress/expected/alter_table.out
src/test/regress/expected/object_address.out
src/test/regress/expected/oidjoins.out
src/test/regress/expected/opr_sanity.out
src/test/regress/sql/alter_table.sql
src/test/regress/sql/object_address.sql
src/test/regress/sql/oidjoins.sql
src/test/regress/sql/opr_sanity.sql
src/tools/findoidjoins/README