Skip to content

oracle pg_regress creates the regression database over the Oracle port, breaking NO_LOCALE/ENCODING modules #2127

Open

Description

@123123213weqw

Summary

A module that sets NO_LOCALE or ENCODING cannot run under make oracle-check: the
test database is created through the Oracle port, where identifiers are folded to
upper case, so the harness creates CONTRIB_REGRESSION and then fails to connect to
contrib_regression. Every test in the module reports failure without running a
single statement.

Reproduction (master 63fb0bfe615, debug/cassert build)

$ make -C src/oracle_test/modules/test_oat_hooks oracle-check   # with ORA_REGRESS set
# initializing database system by running initdb
# using temp instance on port 58929 with PID ...
psql: error: connection to server on socket "/tmp/pg_regress-XXXX/.s.PGSQL.58929" failed: FATAL:  database "contrib_regression" does not exist
get ivorysql.port failed
not ok 1     - test_oat_hooks
# (test process exited with exit code 2)

Same for test_extensions. The leftover temp instance confirms the name:

$ strings .../tmp_check/data/global/* | grep -i contrib
CONTRIB_REGRESSION

Root cause

  1. regress/pg_regress.c reuses INITDB_TEMPLATE only when the module does not set
    NO_LOCALE/ENCODING (if (initdb_template_dir == NULL || nolocale || ...));
    otherwise it runs its own initdb -m oracle without -C normal.
  2. On that path, PGPORT is already the Oracle port (oraPort = port + 1, set in the
    BEGIN - SQL oracle_test block of pg_regress.c), so create_database() runs with
    compatible_mode = oracle and the quoted name is upper-cased.

Verified directly with the same build:

$ psql -p <oracle port> -c 'CREATE DATABASE "aaa_via_oracle" TEMPLATE=template0'
$ psql -p <pg port>     -c 'CREATE DATABASE "bbb_via_pg" TEMPLATE=template0'
$ psql -c 'SELECT datname FROM pg_database ORDER BY 1'
AAA_VIA_ORACLE
bbb_via_pg

while a cluster created with initdb -C normal (what the Makefile template uses)
keeps the case through the Oracle port, which is why other modules are unaffected.

Proposal

Create the regression database through the normal port, or pass -C normal to the
initdb that pg_regress runs itself, so that the created name matches the name the
tests connect to.

Activity

  1. NotHimmel commented on Sep 20, 2026

    @NotHimmel
    Collaborator

    Thanks for reporting this issue.

  2. Wang1rrr commented on Sep 21, 2026

    @Wang1rrr
    Contributor

    /assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions