Unit tests for the functions in sql/functions. Every test_*.sql file defines one or more tests as functions or
procedures in the dba_test schema. They use the assertion helpers from test_helpers.sql and record PASS, FAIL or
SKIP per check.
These tests are separate from the smoke test in test/ (tables.sql, run_functions.sql, configuration.sql,
cleanup.sql).
-
A PostgreSQL server you can create databases on. The tests were written for PostgreSQL 13 and later.
-
psqlon yourPATH. -
Connection settings. By default the runner uses
localhost, port5432and your OS user ($USER). Override them through the environment or intest_config.env:DB_HOSTDB_PORTDB_USER
test_config.envis read, not sourced. It may only containDB_HOST=value,DB_PORT=valueandDB_USER=valuelines (and comments). Environment variables take precedence over the file. -
A local server. The runner refuses a
DB_HOSTother thanlocalhost,127.0.0.1,::1or a socket directory, unlessPARTITION_TESTS_ALLOW_REMOTE=1is set. -
A superuser. Some tests modify system catalogs directly, and the two
partition_report_table_free_extends_below_*tests useCOPY ... TO/FROMa randomly named file in/tmp, which is emptied after it is read.
./test/framework/run_partition_tests.sh./test/framework/run_partition_tests.sh test_partition_calculate_free_partitions- Drops and creates the database
partition_framework_test. The runner marks the database with a comment and refuses to drop an existingpartition_framework_testthat does not carry that comment. - Loads
test/setup_schema.sqland all functions throughsql/functions/create_all_functions.sql. - Loads
test_helpers.sqland everytest_*.sqlfile. - Runs all tests and prints a result table and a summary.
- Drops the database when all tests pass. When a test fails the database is kept so you can inspect it.
- The tests for
partition_detach_partitions,partition_detach_partitions_without_uuidv7,partition_query_based_detach_partitions,partition_query_based_maintenance_detach_partitions,partition_maintenance,partition_table_revertandpartition_table_revert_fkuse transaction control. The runner executes them separately fromdba_test.run_all_tests(). - UUIDv7 tests always run, because the library ships
dba.uuid_v7_to_timestamptzanddba.uuid_timestamptz_to_v7. test_security_hardening.sqlchecks that quotes in partition names cannot break out of generated statements, thatsearch_pathis pinned, and that the UUIDv7 helpers match PostgreSQL 18's built-in functions.- Some checks are skipped by design. They show up as
SKIPin the results.