Skip to content

Fix copyencoding regression in non-ASCII build paths - #3280

Open
nawei123 wants to merge 1 commit into
IvorySQL:masterfrom
nawei123:fix/copyencoding-non-ascii-test-path
Open

nawei123 wants to merge 1 commit into
IvorySQL:masterfrom
nawei123:fix/copyencoding-non-ascii-test-path

Conversation

@nawei123

@nawei123 nawei123 commented Nov 16, 2026 •

Copy link
Copy Markdown

Fixes #3289.

The streaming recovery regression fails in a checkout whose absolute path contains Chinese characters. When copyencoding.sql changes the client encoding to LATIN1 or EUC_JP, psql interpolates the UTF-8 build path into SQL using the new encoding. File lookup and parsing then fail before the intended COPY encoding checks can run.

Change into the regression output directory while the connection still uses UTF-8. Use psql's \copy with relative client-side filenames for the three calls made under a different client encoding. The server still performs the CSV and JSON data conversion. Existing server-file coverage remains in the explicit ENCODING cases, and the JSON byte checks still verify the LATIN1 output.

On macOS arm64 with master 475ab19 and a Chinese checkout path:

  • The original pg_regress copyencoding fails with file-not-found and invalid multibyte character errors. The updated test passes.
  • make -C src/test/recovery installcheck PROVE_TESTS=t/027_stream_regress.pl passes all 11 TAP assertions, including the SQL regression run.
  • git diff --check passes.

Follow-up local verification used a clean macOS build with libxslt enabled. The world run passed all 246 core SQL regressions, including copyencoding, along with recovery, subscription, and the contrib tests including xml2. The run then stopped because the pg_upgrade test extension was absent. After compiling that fixture, pg_upgrade passed all 127 assertions. The remaining psql prompt test timed out without readline. After rebuilding psql with readline, all 251 psql TAP assertions and all 360 scripts TAP assertions passed. The remaining world targets were verified in separate runs. The two files in this PR match the tested files byte for byte.

The local macOS build used the existing libpq build dependency from #2989 for both test versions. The two test files are the full scope of this PR.

Assisted-by: OpenAI:GPT-6
Percentage of AI-generated code: 100%

Summary by CodeRabbit

  • Tests
    • Updated regression coverage for COPY operations with client-encoding differences. Tests now use paths relative to the build directory and continue to verify successful and invalid-encoding imports, along with implicit JSON output. No user-facing behavior changes.

Assisted-by: OpenAI:GPT-6
Percentage of AI-generated code: 100%
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The regression test changes into the build directory and uses psql \copy with relative paths for two client-encoding input cases and one JSON output case. The expected output reflects these changes.

Changes: COPY encoding test paths

Layer / File(s) Summary
Use relative paths for encoding cases
src/test/regress/sql/copyencoding.sql, src/test/regress/expected/copyencoding.out
The test changes into the build directory and uses relative paths with psql \copy for the LATIN1 and EUC_JP input cases and the implicit LATIN1 JSON output case. The expected output reflects the updated commands.

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

Change: Other

Suggested reviewers: oreoyang, adunstan

Merge Risk: Minimal · up to 8c136

This is a test-only change that makes the copyencoding regression test work in checkouts with non-ASCII paths. The one remaining concern needs an unusual setup (server and client as different OS users plus a restrictive umask), so it does not block merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: it fixes the copyencoding regression test when the build path contains non-ASCII characters. The raw summary and objectives both show the test now switches to the buil…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: it fixes the copyencoding regression test when the build path contains non-ASCII characters. The raw summary and objectives both show the test now switches to the build directory and uses relative paths in \copy commands, which addresses this failure. The title is specific and matches the changeset, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 475ab19 and 8c13650.

Files selected for processing: 2

  • src/test/regress/expected/copyencoding.out
  • src/test/regress/sql/copyencoding.sql

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

@hs-liuxh

Copy link
Copy Markdown
Collaborator

Thanks for contributing to IvorySQL!

@hs-liuxh hs-liuxh self-assigned this Nov 20, 2026
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.

copyencoding regression fails in non-ASCII build directories

2 participants