Repository navigation
don't allow setting ivorysql.compatible_mode via ALTER USER/DATABASE SET - #1363
Conversation
📝 WalkthroughWalkthroughIntroduces a new GUC flag bit ChangesGUC disallow-in-db-role-setting mechanism
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/backend/catalog/pg_db_role_setting.c`:
- Around line 40-45: The ereport statement following the conditional check on
record and GUC_DISALLOW_IN_DB_ROLE_SETTING flag needs to be properly indented.
The ereport call with its errcode, errmsg, and errhint arguments should be
indented one tab level further to align as the body of the if statement,
matching the project's coding style conventions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0ecf81cf-2ac9-4322-a19a-72f6c187e987
⛔ Files ignored due to path filters (1)
src/backend/utils/misc/guc_parameters.datis excluded by!**/*.dat
📒 Files selected for processing (3)
src/backend/catalog/pg_db_role_setting.csrc/backend/utils/misc/ivy_guc.csrc/include/utils/guc.h
| if (record && (record->flags & GUC_DISALLOW_IN_DB_ROLE_SETTING)) | ||
| ereport(ERROR, | ||
| (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), | ||
| errmsg("cannot set parameter \"%s\" via ALTER USER/ROLE/DATABASE SET", | ||
| setstmt->name), | ||
| errhint("Use SET command in session instead."))); |
There was a problem hiding this comment.
Fix indentation for the ereport statement.
The ereport call should be indented to match the coding style of the surrounding code. Currently it appears to be at the wrong indentation level.
🔧 Proposed fix for indentation
record = find_option(setstmt->name, false, true, WARNING);
if (record && (record->flags & GUC_DISALLOW_IN_DB_ROLE_SETTING))
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot set parameter \"%s\" via ALTER USER/ROLE/DATABASE SET",
- setstmt->name),
- errhint("Use SET command in session instead.")));
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot set parameter \"%s\" via ALTER USER/ROLE/DATABASE SET",
+ setstmt->name),
+ errhint("Use SET command in session instead.")));📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (record && (record->flags & GUC_DISALLOW_IN_DB_ROLE_SETTING)) | |
| ereport(ERROR, | |
| (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), | |
| errmsg("cannot set parameter \"%s\" via ALTER USER/ROLE/DATABASE SET", | |
| setstmt->name), | |
| errhint("Use SET command in session instead."))); | |
| if (record && (record->flags & GUC_DISALLOW_IN_DB_ROLE_SETTING)) | |
| ereport(ERROR, | |
| (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), | |
| errmsg("cannot set parameter \"%s\" via ALTER USER/ROLE/DATABASE SET", | |
| setstmt->name), | |
| errhint("Use SET command in session instead."))); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/backend/catalog/pg_db_role_setting.c` around lines 40 - 45, The ereport
statement following the conditional check on record and
GUC_DISALLOW_IN_DB_ROLE_SETTING flag needs to be properly indented. The ereport
call with its errcode, errmsg, and errhint arguments should be indented one tab
level further to align as the body of the if statement, matching the project's
coding style conventions.
…mode-change-in-alter-set don't allow setting ivorysql.compatible_mode via ALTER USER/DATABASE SET (cherry picked from commit a4d51e8)
…mode-change-in-alter-set don't allow setting ivorysql.compatible_mode via ALTER USER/DATABASE SET (cherry picked from commit a4d51e8)
fix issue #1357
The value of ivorysql.compatible_mode is determined by port or can be set using SET command in session.
But it cannot be set via ALTER USER/DATABASE SET.