Skip to content

set identifier_vase_switch to value from pg_control file#800

Merged
gaoxueyu merged 1 commit intoIvorySQL:masterfrom
bigplaice:master
May 9, 2025
Merged

set identifier_vase_switch to value from pg_control file#800
gaoxueyu merged 1 commit intoIvorySQL:masterfrom
bigplaice:master

Conversation

@bigplaice
Copy link
Copy Markdown
Collaborator

@bigplaice bigplaice commented May 8, 2025

so that configure file value can take effect.

Also comment out the identifier_vase_switch in ivorysql.conf.sample to avoid overriding the "initdb -C case_mode" operation.

Summary by CodeRabbit

  • Chores
    • Adjusted the default behavior for identifier case conversion settings.
    • Updated the timing of internal configuration initialization during startup.
    • Commented out the sample configuration for identifier case conversion, making it inactive by default.

so that configure file value can take effect.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented May 8, 2025

Walkthrough

The changes update how and when the ivorysql.identifier_case_switch configuration is set during database startup. The GUC option is now set with a different source context and at an earlier stage in the process. Additionally, the sample configuration file comments out the related setting, making it inactive by default.

Changes

File(s) Change Summary
src/backend/access/transam/xlog.c Modified SetCaseGucOption to use PGC_S_DEFAULT instead of PGC_S_OVERRIDE for GUC setting.
src/backend/postmaster/postmaster.c Moved SetCaseGucOption(userDoption) to execute before SelectConfigFiles.
src/backend/utils/misc/ivorysql.conf.sample Commented out the ivorysql.identifier_case_switch setting, disabling it by default.

Sequence Diagram(s)

sequenceDiagram
    participant Postmaster
    participant ConfigFiles
    participant XLog

    Postmaster->>XLog: SetCaseGucOption(userDoption)
    Postmaster->>ConfigFiles: SelectConfigFiles(userDoption, progname)
    Note right of Postmaster: GUC option set before config files are selected
Loading

Poem

In the warren of code, a gentle tweak,
GUCs now set before configs peek.
The case switch rests, its voice now still,
Awaiting commands by default’s will.
With timing and context both refined,
The database hops ahead, redefined!
🐇✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b8037e and 8d8bbdf.

📒 Files selected for processing (3)
  • src/backend/access/transam/xlog.c (1 hunks)
  • src/backend/postmaster/postmaster.c (1 hunks)
  • src/backend/utils/misc/ivorysql.conf.sample (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/backend/postmaster/postmaster.c (1)
src/backend/access/transam/xlog.c (1)
  • SetCaseGucOption (5435-5466)
src/backend/access/transam/xlog.c (1)
src/backend/utils/misc/guc.c (1)
  • SetConfigOption (4288-4294)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: contrib_regression
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: meson_build (ubuntu-latest)
  • GitHub Check: oracle_regression (ubuntu-latest)
  • GitHub Check: oracle_pg_regression (ubuntu-latest)
  • GitHub Check: pg_regression (ubuntu-latest)
🔇 Additional comments (6)
src/backend/utils/misc/ivorysql.conf.sample (1)

13-13: Commenting out default case conversion mode in sample config is correct
This change prevents the sample configuration from overriding the behavior set by initdb -C case_mode, ensuring consistency with the new SetCaseGucOption logic.

src/backend/postmaster/postmaster.c (1)

776-778: Verify pg_control lookup path before DataDir is set
The call to SetCaseGucOption(userDoption) now occurs before SelectConfigFiles, meaning it uses the raw -D value (or NULL) to locate pg_control. Please confirm that GetDatabaseStyleFromControl correctly handles a NULL or relative userDoption (falling back to the actual data directory) and that this ordering cannot lead to an uninitialized or incorrect path causing startup failures.

src/backend/access/transam/xlog.c (4)

5449-5451: Changing source context from OVERRIDE to DEFAULT for identifier_case_switch.

By modifying the source context from what was previously PGC_S_OVERRIDE to PGC_S_DEFAULT, this change allows the configuration file setting for ivorysql.identifier_case_switch to take precedence over the value stored in the control file when using "normal" case mode. This ensures that configuration settings in postgresql.conf can properly override the default value from the control file.


5454-5456: Changing source context from OVERRIDE to DEFAULT for interchange mode.

Similar to the change for "normal" mode, this ensures that the "interchange" mode setting from the configuration file can override the default value from the control file. This behavior is more consistent with how other PostgreSQL GUCs work.


5459-5461: Changing source context from OVERRIDE to DEFAULT for lowercase mode.

This completes the set of changes for all three possible case modes (normal, interchange, and lowercase), ensuring consistent behavior across all possible settings when the database is in Oracle compatibility mode.


5432-5466: SetCaseGucOption implementation fits well with postmaster changes.

The changes to use PGC_S_DEFAULT instead of PGC_S_OVERRIDE work correctly with the related change in postmaster.c that moves the SetCaseGucOption call to before SelectConfigFiles. Together, these changes ensure:

  1. The control file values are read and set as defaults
  2. Then configuration files are processed, where settings can override the defaults
  3. The initdb -C case_mode operation behaves as expected

This resolves the issue where the control file values would always override configuration settings, preventing proper customization.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@gaoxueyu gaoxueyu merged commit 161b470 into IvorySQL:master May 9, 2025
6 checks passed
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.

2 participants