]> git.ipfire.org Git - thirdparty/postgresql.git/commit
test_custom_types: Test module with fancy custom data types
authorMichael Paquier <michael@paquier.xyz>
Mon, 2 Mar 2026 02:10:39 +0000 (11:10 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 2 Mar 2026 02:10:39 +0000 (11:10 +0900)
commit8eedbc2cc4b37a5e0a5f6a158ddc77b8059930bc
treea1918f159bf704fec8056aa79f109b2ea448484a
parentf033abc6c4f2639f0e498ff256f6c9407793abbb
test_custom_types: Test module with fancy custom data types

This commit adds a new test module called "test_custom_types", that can
be used to stress code paths related to custom data type
implementations.

Currently, this is used as a test suite to validate the set of fixes
done in 3b7a6fa15720, that requires some typanalyze callbacks that can
force very specific backend behaviors, as of:
- typanalyze callback that returns "false" as status, to mark a failure
in computing statistics.
- typanalyze callback that returns "true" but let's the backend know
that no interesting stats could be computed, with stats_valid set to
"false".

This could be extended more in the future if more problems are found.
For simplicity, the module uses a fake int4 data type, that requires a
btree operator class to be usable with extended statistics.  The type is
created by the extension, and its properties are altered in the test.

Like 3b7a6fa15720, this module is backpatched down to v14, for coverage
purposes.

Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aaDrJsE1I5mrE-QF@paquier.xyz
Backpatch-through: 14
src/test/modules/Makefile
src/test/modules/test_custom_types/.gitignore [new file with mode: 0644]
src/test/modules/test_custom_types/Makefile [new file with mode: 0644]
src/test/modules/test_custom_types/README [new file with mode: 0644]
src/test/modules/test_custom_types/expected/test_custom_types.out [new file with mode: 0644]
src/test/modules/test_custom_types/meson.build [new file with mode: 0644]
src/test/modules/test_custom_types/sql/test_custom_types.sql [new file with mode: 0644]
src/test/modules/test_custom_types/test_custom_types--1.0.sql [new file with mode: 0644]
src/test/modules/test_custom_types/test_custom_types.c [new file with mode: 0644]
src/test/modules/test_custom_types/test_custom_types.control [new file with mode: 0644]