pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Create the infrastructure for planner support functions.
Date: Sat, 09 Feb 2019 23:09:02 +0000
Message-ID: <E1gsbk6-0004E5-Ny@gemulon.postgresql.org> (raw)

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1fb57af92069ee104c09e2016af9e0e620681be3

Modified Files
--------------
doc/src/sgml/catalogs.sgml                         |   6 +-
doc/src/sgml/keywords.sgml                         |   7 ++
doc/src/sgml/ref/alter_function.sgml               |  19 +++
doc/src/sgml/ref/create_function.sgml              |  14 +++
doc/src/sgml/xfunc.sgml                            | 120 +++++++++++++-----
doc/src/sgml/xoper.sgml                            |  12 ++
src/backend/catalog/pg_aggregate.c                 |   1 +
src/backend/catalog/pg_depend.c                    |  52 +++++---
src/backend/catalog/pg_proc.c                      |  12 +-
src/backend/commands/functioncmds.c                |  88 ++++++++++++-
src/backend/commands/proclang.c                    |   3 +
src/backend/commands/typecmds.c                    |   1 +
src/backend/optimizer/util/clauses.c               |  23 +++-
src/backend/parser/gram.y                          |   7 +-
src/backend/utils/adt/date.c                       |  23 +++-
src/backend/utils/adt/datetime.c                   |  17 ++-
src/backend/utils/adt/numeric.c                    |  69 ++++++-----
src/backend/utils/adt/ruleutils.c                  |  15 +++
src/backend/utils/adt/timestamp.c                  | 138 ++++++++++-----------
src/backend/utils/adt/varbit.c                     |  48 ++++---
src/backend/utils/adt/varchar.c                    |  48 ++++---
src/bin/pg_dump/pg_dump.c                          |  39 +++++-
src/bin/pg_dump/t/002_pg_dump.pl                   |  22 +++-
src/include/catalog/catversion.h                   |   2 +-
src/include/catalog/pg_proc.dat                    |  81 ++++++------
src/include/catalog/pg_proc.h                      |   5 +-
src/include/nodes/nodes.h                          |   3 +-
src/include/nodes/supportnodes.h                   |  70 +++++++++++
src/include/parser/kwlist.h                        |   1 +
src/include/utils/datetime.h                       |   2 +-
.../test_ddl_deparse/expected/create_transform.out |   2 +-
.../test_ddl_deparse/sql/create_transform.sql      |   2 +-
src/test/regress/expected/alter_table.out          |   5 +-
src/test/regress/expected/object_address.out       |   2 +-
src/test/regress/expected/oidjoins.out             |  10 +-
src/test/regress/expected/opr_sanity.out           |   4 +-
src/test/regress/sql/alter_table.sql               |   5 +-
src/test/regress/sql/object_address.sql            |   2 +-
src/test/regress/sql/oidjoins.sql                  |   6 +-
src/test/regress/sql/opr_sanity.sql                |   4 +-
src/tools/findoidjoins/README                      |   2 +-
41 files changed, 698 insertions(+), 294 deletions(-)



Message-ID: <E1gsbk6-0004E5-Ny@gemulon.postgresql.org>
Permalink:  ../E1gsbk6-0004E5-Ny@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gsbk6-0004E5-Ny@gemulon.postgresql.org

 · 

reply

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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Create the infrastructure for planner support functions.
  In-Reply-To: <E1gsbk6-0004E5-Ny@gemulon.postgresql.org>
  References: <E1gsbk6-0004E5-Ny@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