Skip to content

Fix oracle-check database initialization outside template mode - #2167

Open
Wang1rrr wants to merge 1 commit into
IvorySQL:masterfrom
Wang1rrr:fix/oracle-regress-initdb-case
Open

Wang1rrr wants to merge 1 commit into
IvorySQL:masterfrom
Wang1rrr:fix/oracle-regress-initdb-case

Conversation

@Wang1rrr

@Wang1rrr Wang1rrr commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2127.

When the Oracle regression harness creates its own cluster, it runs initdb -m oracle without the identifier-case setting already used by both the Autoconf
and Meson initdb templates. In the default interchange mode, creating the quoted
contrib_regression database through the Oracle port creates
CONTRIB_REGRESSION; the following connection to the lowercase name fails before
any test SQL runs.

Pass -C normal in the fresh-initdb path to match the template path. This is a
one-line harness change, not a change to server defaults. Explicit
PG_TEST_INITDB_EXTRA_OPTS remain later in the command and can still override
the case mode. The affected paths include an absent template, NO_LOCALE, and
other conditions that force fresh initialization; ENCODING alone does not
force that branch in the current code.

This change is scoped to the oracle-check driver under src/oracle_test. The separate src/test/regress/ora_pg_regress.c driver used by oracle-pg-check restores PGPORT to the normal port after probing the Oracle port. Its unchanged fresh-initdb path passed independent --no-locale --encoding=UTF8 smoke runs and the real test_oat_hooks/alter_table SQL tests, so it is not changed here.

Verification

Tested from master 63fb0bfe6159fb91b03012eea09f3db7cd46db8c in a real WSL Linux
debug/cassert build, with original and patched binaries kept separately:

  • Clean build and installation succeeded.
  • make -C src/oracle_test/modules/test_oat_hooks oracle-check ORA_REGRESS=test_oat_hooks: original fails with missing contrib_regression;
    patched passes (1/1).
  • No-template smoke, --no-locale --encoding=UTF8 smoke, and case_conversion
    pass. The smoke checks the lowercase database name and normal case mode.
  • Fresh-cluster replay independently reproduces the original connection
    failure and patched success, with INITDB_TEMPLATE and
    PG_TEST_INITDB_EXTRA_OPTS unset.

test_extdepend also passes. test_extensions executes after the fix but retains
an existing expected-output mismatch (bit varying versus pg_catalog.varbit).
Running the original binary with PG_TEST_INITDB_EXTRA_OPTS='-C normal' produces
byte-identical extension output to the patched binary, isolating that mismatch
from this change. Full installcheck-world and native Windows/Meson builds were
not run. All test server instances were stopped.

PR #2128 references this blocker but changes different module files; this patch
only changes src/oracle_test/regress/pg_regress.c.

Assisted-by: OpenAI:gpt-5.4
Percentage of AI-generated code: 100%

Summary by CodeRabbit

  • Tests
    • Regression test instances now initialize with normal compatibility mode, improving consistency when running Oracle-mode tests.

When pg_regress cannot reuse INITDB_TEMPLATE, initialize with the same
normal identifier-case mode used by the Autoconf and Meson templates.
Otherwise a quoted contrib_regression name is upper-cased via the Oracle
port, and the harness cannot connect to the database it just created.
Explicit PG_TEST_INITDB_EXTRA_OPTS remain later in the command line.

Related: IvorySQL#2127
Constraint: Match the existing Oracle template defaults without changing server defaults
Confidence: high
Scope-risk: narrow
Tested: Debug/cassert build; test_oat_hooks; case_conversion; clean baseline/fixed no-template replay; no-locale UTF8 smoke
Not-tested: Full installcheck-world
Known-failure: test_extensions retains an unrelated type-display expectation difference
Assisted-by: OpenAI:gpt-5.4
Percentage of AI-generated code: 100%
Copilot AI lite review requested due to automatic review settings September 21, 2026 15:50
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: IvorySQL/IvorySQL/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 035544ef-a4e7-49fa-b637-131fe5188675

📥 Commits

Reviewing files that changed from the base of the PR and between 63fb0bf and 51ccc44.

📒 Files selected for processing (1)
  • src/oracle_test/regress/pg_regress.c

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The Oracle regression harness now passes -C normal when it initializes a temporary data directory. This keeps regression database naming consistent when the harness uses the Oracle port.

Changes

Oracle regression initialization

Layer / File(s) Summary
Set normal compatibility mode
src/oracle_test/regress/pg_regress.c
The initdb command now includes -C normal after -m oracle.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: hs-liuxh

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue [#2127] requires fresh Oracle regression clusters to preserve the regression database name across initialization and Oracle-port connections. The change adds -C normal to the fresh initdb co…
Out of Scope Changes check ✅ Passed The whole pull-request diff contains one change in src/oracle_test/regress/pg_regress.c. The change adds -C normal to the initdb invocation that addresses Issue [#2127]. No unrelated source or t…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing Oracle regression database initialization when the process runs outside template mode.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The separate src/test/regress/ora_pg_regress.c driver still lacks the corresponding -C normal fix.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes Oracle regression setup failures by aligning fresh-cluster initialization with template-based identifier casing.

Changes:

  • Adds -C normal to fresh Oracle initdb execution.
  • Preserves later PG_TEST_INITDB_EXTRA_OPTS overrides.
File Description
src/​oracle_test/​regress/​pg_regress.c Sets normal identifier-case mode for fresh clusters.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


appendStringInfo(&cmd,
"\"%s%sinitdb\" -D \"%s/data\" -m oracle --no-clean --no-sync",
"\"%s%sinitdb\" -D \"%s/data\" -m oracle -C normal --no-clean --no-sync",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the two paths separately. ora_pg_regress restores PGPORT to the normal port after probing the Oracle port; the oracle-check driver does not. The unchanged ora_pg_regress passed two fresh-cluster smoke runs with --no-locale --encoding=UTF8 and executed test_oat_hooks plus alter_table (2/2), so the missing-database failure did not reproduce there. The title and description now explicitly scope this PR to oracle-check; the second driver is left unchanged.

@Wang1rrr Wang1rrr changed the title Fix Oracle regression initialization outside template mode Fix oracle-check database initialization outside template mode Sep 21, 2026
@NotHimmel

Copy link
Copy Markdown
Collaborator

Thanks for contributing to IvorySQL!

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

Reviewers

Couldn't load reviewers.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants