Skip to content

contrib/ivorysql_ora: refuse non-UTF8 test encodings up front - #1958

Open
muzimu217 wants to merge 1 commit into
IvorySQL:masterfrom
muzimu217:fix/1883-latin1-regression
Open

contrib/ivorysql_ora: refuse non-UTF8 test encodings up front#1958
muzimu217 wants to merge 1 commit into
IvorySQL:masterfrom
muzimu217:fix/1883-latin1-regression

Conversation

@muzimu217

@muzimu217 muzimu217 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #1883.

Root cause

The five failures are not product bugs — every one of them is correct behaviour for a single-byte test database. The expected results encode UTF8-specific facts:

  • ora_character truncates multibyte literals against VARCHAR2 byte limits (lengthb(cast('中文' AS varchar2(5 byte))) = 3); on LATIN1 a byte is a character, so the truncation point legitimately differs.
  • ora_character_datatype_functions checks length/lengthc character counts, chr() codepoints that only exist in Unicode (chr(769), chr(2392), chr(119070) → "requested character too large"), UTF8-only normalization (compose/decompose → "Unicode normalization can only be performed if server encoding is UTF8"), unistr() and to_multi_byte(), plus psql column alignment that depends on character counts.
  • ora_misc_functions exercises compose/decompose the same way.
  • datatype_and_func_bugs inserts '测试' into char(3 char); under LATIN1 the literal is six characters, so "value too long" is the correct answer.
  • utl_url escapes multibyte input and converts between character sets, so its multibyte expectations are UTF8-bound by nature (and a LATIN1 → GB18030 conversion does not exist in PostgreSQL).

A single-byte Oracle database could not store these literals either, so there is no LATIN1 behaviour to pin down: the tests are about multibyte semantics, and those only exist under UTF8.

Fix

Since the suite is inherently UTF8-bound, make that requirement explicit at the suite level instead of letting a non-UTF8 run surface as five seemingly unrelated failures. contrib/ivorysql_ora/Makefile already pins ENCODING = UTF8 by default; this adds a guard so an explicit non-UTF8 override fails up front with a clear message rather than running (and failing) the suite:

Makefile:78: *** ivorysql_ora regression tests require ENCODING=UTF8 (got 'LATIN1'); the expected outputs are only valid for a UTF8 test database.  Stop.

Targets that do not run the regression suite (all, install, ...) are unaffected.

Verification

oracle-check on a clean tree (Linux aarch64):

invocation result
make -C contrib/ivorysql_ora oracle-check ENCODING=LATIN1 refused up front with the message above (previously: 5 of 28 tests failed)
LC_ALL=en_US.UTF-8 make -C contrib/ivorysql_ora oracle-check All 28 tests passed
LC_ALL=C make -C contrib/ivorysql_ora oracle-check All 28 tests passed

Summary by CodeRabbit

  • Bug Fixes
    • Regression tests now consistently use UTF-8 encoding.
    • Invalid non-UTF-8 encoding overrides are rejected for Oracle compatibility test commands, preventing misleading test results.

The five oracle-check failures reported under ENCODING=LATIN1 are not
product bugs: every one of them is the correct behaviour for a
single-byte database.  The expected results encode UTF8-specific facts
(character counts under CHAR length semantics, chr() codepoints that
only exist in Unicode, UTF8-only normalization such as COMPOSE and
DECOMPOSE, and utl_url escape output for whole character sets), so a
non-UTF8 run cannot pass without rewriting the tests in ways that would
remove exactly the multibyte coverage they exist for.

The suite already pins ENCODING = UTF8 by default; make an explicit
non-UTF8 override fail fast with a clear message instead of surfacing
as five seemingly unrelated failures.

Fixes IvorySQL#1883

Signed-off-by: muzimu217 <muzimu217@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 9e29c21a-4110-4659-abc2-218acc23e5ba

📥 Commits

Reviewing files that changed from the base of the PR and between 481c238 and 3685363.

📒 Files selected for processing (1)
  • contrib/ivorysql_ora/Makefile

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


📝 Walkthrough

Walkthrough

The Oracle regression Makefile now pins the test database encoding to UTF8 and rejects non-UTF8 overrides for the oracle-check and oracle-installcheck goals.

Changes

Oracle regression encoding

Layer / File(s) Summary
Encoding pin and validation
contrib/ivorysql_ora/Makefile
The Makefile sets ENCODING = UTF8, documents the UTF8-dependent tests, and rejects non-UTF8 overrides for the Oracle regression goals.

Priority: ➖ Normal

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

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 36853

Oracle regression runs now consistently use UTF8 and clearly reject unsupported encoding overrides, preventing encoding-dependent test failures without affecting other targets.

Suggested reviewers: bigplaice, jiaoshuntian, hs-liuxh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: rejecting non-UTF8 test encodings in the contrib/ivorysql_ora regression suite.
Linked Issues check ✅ Passed The changes satisfy issue #1883 by enforcing the suite's UTF8 requirement and rejecting explicit non-UTF8 overrides before regression tests run. The default UTF8 behavior and unrelated make targets re…
Out of Scope Changes check ✅ Passed The changes are limited to the contrib/ivorysql_ora Makefile and directly support the linked issue. No unrelated code changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@hanjianqiao

Copy link
Copy Markdown
Collaborator

Thanks for the PR!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

contrib/ivorysql_ora: five regression tests fail when the test database uses LATIN1

2 participants