test_extensible: Test module for extensible nodes and custom scans

This commit adds a new test module that implements a CustomScan based on
an ExtensibleNode.  These APIs exist in the core code for ages but had
zero coverage.  This now covers the read, copy and out routines for
extensible nodes, with SQL function wrappers for each.  CustomScan nodes
are tested with callbacks to manipulate the executor, based on the idea
of repeating the number of times each row is returned in a single scan,
using a GUC (default at 2 tuples for each row, can be tweaked).

The code of this module is primitive to keep its logic simpler.  For
example, custom scans happen only when matching one specific, hardcoded
relation name, and work only for base relations (this can be extended at
will, as required).

This module can be used as a template for developers willing to develop
their own extensions.  "Writing a Custom Scan Provider" covers the
documentation for custom scans.

Author: Aleksander Alekseev <[email protected]>
Reviewed-by: Jan Nidzwetzki <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Reviewed-by: Rafia Sabih <[email protected]>
Discussion: 
https://postgr.es/m/CAJ7c6TNfn9Fv_Je1etA6rrgq1onVvXbjwBTkbkd4kVQhcu11gg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0e944fe3579ecd525e5ffe7b7db4a7e1c34de49e

Modified Files
--------------
src/test/modules/Makefile                          |   1 +
src/test/modules/meson.build                       |   1 +
src/test/modules/test_extensible/.gitignore        |   4 +
src/test/modules/test_extensible/Makefile          |  23 +
.../test_extensible/expected/test_extensible.out   | 242 +++++++++
src/test/modules/test_extensible/meson.build       |  33 ++
.../test_extensible/sql/test_extensible.sql        |  83 +++
.../test_extensible/test_extensible--1.0.sql       |  25 +
src/test/modules/test_extensible/test_extensible.c | 568 +++++++++++++++++++++
.../test_extensible/test_extensible.control        |   4 +
src/tools/pgindent/typedefs.list                   |   2 +
11 files changed, 986 insertions(+)

Reply via email to