Skip to content

Fix pg_dump package ACLs, native-PG SET, and initdb dbmode case - #1683

Open
Aias00 wants to merge 1 commit into
IvorySQL:masterfrom
Aias00:fix/pgdump-initdb-1682
Open

Fix pg_dump package ACLs, native-PG SET, and initdb dbmode case#1683
Aias00 wants to merge 1 commit into
IvorySQL:masterfrom
Aias00:fix/pgdump-initdb-1682

Conversation

@Aias00

@Aias00 Aias00 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1682.

  1. Package ACLs never dumped (src/bin/pg_dump/pg_dump.c): dacl.acl is now assigned and the ACL component is cleared only when the ACL is NULL (the condition was inverted, and the comment already said the opposite). GRANTs on Oracle packages are now preserved on restore.
  2. Unconditional SET breaks native-PG dumps: the SET ivorysql.identifier_case_switch = normal is now guarded by a pg_settings probe (same pattern as the relhasrowid runtime probe), so the PG→IvorySQL upgrade path works.
  3. initdb --dbmode=PG: strcmppg_strcasecmp, matching the other dbmode checks.
  4. Warning prefix/newline duplication removed.

Test plan

  • pg_dump.o and initdb.o compile cleanly (full link is blocked locally by the known macOS ivy_sema.c issue).

Summary by CodeRabbit

  • Bug Fixes
    • Improved database initialization so mode selection works regardless of letter casing.
    • Enhanced pg_dump compatibility with native PostgreSQL databases by safely handling optional configuration settings.
    • Preserved package access-control information only when available.
    • Improved warning messages for invalid package owners, making them clearer and more consistent.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Review 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: Pro Plus

Run ID: 19f389e2-59d8-4906-961c-fd4da86a84a8

📥 Commits

Reviewing files that changed from the base of the PR and between c3529ba and ae032f2.

📒 Files selected for processing (2)
  • src/bin/initdb/initdb.c
  • src/bin/pg_dump/pg_dump.c

Included review availability: Your plan includes up to 4 reviews per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The changes make PostgreSQL mode detection case-insensitive. pg_dump now conditionally sets the IvorySQL identifier GUC, preserves package ACLs, and formats invalid package owner warnings through the logging framework.

Changes

Compatibility and dump corrections

Layer / File(s) Summary
Case-insensitive PostgreSQL mode detection
src/bin/initdb/initdb.c
initialize_data_directory uses pg_strcasecmp to recognize mixed-case PostgreSQL mode values.
Native PostgreSQL dump compatibility
src/bin/pg_dump/pg_dump.c
pg_dump checks pg_settings before setting ivorysql.identifier_case_switch. Package ACL metadata is assigned, ACL dumping is disabled only when no ACL exists, and invalid-owner warnings use standard logging formatting.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to ae032

The PR makes localized fixes to ACL preservation, session setup, and case-insensitive dbmode parsing. No concrete current-head correctness or deployment risk requires blocking merge; it is merge-ready after normal checks.

Possibly related PRs

🚥 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 identifies the package ACL, native PostgreSQL SET, and initdb dbmode fixes.
Linked Issues check ✅ Passed The changes address all four requirements in issue #1682: package ACLs, GUC probing, case-insensitive dbmode handling, and warning cleanup.
Out of Scope Changes check ✅ Passed All reported changes directly support the objectives in issue #1682, with no unrelated code changes identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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.

- pg_dump: assign dacl.acl so package ACLs are actually dumped, and
  clear the ACL component only when the ACL is NULL (the condition was
  inverted)
- pg_dump: probe pg_settings before SET ivorysql.identifier_case_switch
  so dumping a native PostgreSQL source does not abort (the
  PG->IvorySQL upgrade path)
- pg_dump: drop the duplicated "WARNING: " prefix and newline from
  pg_log_warning
- initdb: accept --dbmode=PG case-insensitively like the other dbmode
  checks

Closes IvorySQL#1682

Signed-off-by: liuhongyu <liuhongyu@apache.org>
@Aias00
Aias00 force-pushed the fix/pgdump-initdb-1682 branch from ae032f2 to c270473 Compare August 17, 2026 02:54
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.

pg_dump package ACL never dumped; unconditional SET breaks native-PG dumps; initdb dbmode case mismatch

1 participant