Skip to content

Conversation

@OreoYang
Copy link
Owner

Summary

This PR improves code quality in ivy_guc.c with the following changes:

  • Fix typo in comment: "blow" → "below" (line 59)
  • Remove trailing whitespace: Clean up comment formatting (line 187)
  • Fix typo in gettext: "charater" → "character" (line 423)
  • Fix error message: Remove double period (line 480)
  • Add proper error codes: Include errcode() to ereport() calls for better PostgreSQL error handling:
    • ERRCODE_STRING_DATA_RIGHT_TRUNCATION for length validation errors
    • ERRCODE_INVALID_PARAMETER_VALUE for NLS parameter errors
  • Performance optimization: Cache strlen() result in nls_case_conversion() function, changing complexity from O(N²) to O(N)
  • Replace magic numbers: Use character constants ('a', 'z', 'A', 'Z') instead of ASCII codes for better readability

Test Plan

  • Code compiles without warnings
  • Regression tests pass
  • Manual testing of NLS parameter validation
  • Testing of case conversion functions

- Fix typo in comment (line 59): "blow" → "below"
- Remove trailing whitespace in comment (line 187)
- Fix typo in gettext (line 423): "charater" → "character"
- Fix typo in error message (line 480): remove double period
- Add errcode() to ereport() calls (lines 582, 584-585, 604-605):
  * ERRCODE_STRING_DATA_RIGHT_TRUNCATION for length check
  * ERRCODE_INVALID_PARAMETER_VALUE for NLS errors
- Optimize nls_case_conversion() by caching strlen() result
  Change O(N²) to O(N) performance complexity
- Replace magic numbers with character constants:
  * 97, 122 → 'a', 'z'
  * 65, 90 → 'A', 'Z'

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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