Skip to content

PostgreSQL Connection String issue fixed#4500

Merged
ravirk91 merged 2 commits into
masterfrom
PostgresConnectionString-Fix---Master
Jun 17, 2026
Merged

PostgreSQL Connection String issue fixed#4500
ravirk91 merged 2 commits into
masterfrom
PostgresConnectionString-Fix---Master

Conversation

@rathimayur

@rathimayur rathimayur commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description

Type of Change

  • Bug fix - [ ] New feature - [ ] Breaking change - [ ] Plugin update

Checklist

  • PR description clearly describes the changes
  • Target branch is correct (master for features, Releases/* for fixes)
  • Latest code from target branch merged
  • No commented/junk code included
  • No new build warnings or errors
  • All existing unit tests pass
  • New unit tests added for new functionality
  • Cross-platform compatibility verified (Windows/Linux/macOS)
  • CI/CD pipeline passes
  • Code follows project conventions (Act{Platform}{Type}, {Platform}Driver)
  • Repository objects use [IsSerializedForLocalRepository] where needed
  • Error handling uses Reporter.ToLog() pattern
  • Documentation updated for user-facing changes
  • Self-review completed and code review comments addressed

Summary by CodeRabbit

  • Refactor
    • Enhanced PostgreSQL database connection configuration with improved flexibility and validation for connection parameters.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

In DatabaseOperations.Connect(), the PostgreSQL branch now conditionally populates NpgsqlConnectionStringBuilder: if ConnectionStringCalculated is empty, it parses host/port from TNSCalculated and sets individual properties; otherwise it assigns the result of GetConnectionString(). The previous Database.ConnectionString = pg.ConnectionString assignment is removed.

Changes

PostgreSQL Connection String Logic

Layer / File(s) Summary
PostgreSQL NpgsqlConnectionStringBuilder conditional logic
Ginger/GingerCoreNET/Database/DatabaseOperations.cs
Connect()'s PostgreSQL branch is split into two paths based on ConnectionStringCalculated: empty triggers TNS-derived host/port parsing and validation with individual property assignment (Host, Database, Username, decrypted Password); non-empty assigns GetConnectionString() directly to the builder. The prior Database.ConnectionString = pg.ConnectionString line is removed. Minor end-of-file brace adjustment included.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop along the connection path,
TNS or string — no aftermath!
Host and port from parsed delight,
Or GetConnectionString just right.
The builder fills, the brace clicks shut,
A PostgreSQL door, no longer stuck! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description lacks substantive content; it only contains unchecked template checkboxes without describing what changes were made or why the fix was needed. Add a detailed Description section explaining the PostgreSQL connection string issue, the bug being fixed, and how the solution works. Check appropriate Type of Change checkbox and verify checklist items are addressed.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'PostgreSQL Connection String issue fixed' clearly and specifically describes the main change - fixing a PostgreSQL connection string issue in the DatabaseOperations class.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PostgresConnectionString-Fix---Master

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 and usage tips.

@codacy-production

codacy-production Bot commented Jun 16, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@Ginger/GingerCoreNET/Database/DatabaseOperations.cs`:
- Around line 433-439: The Password property assignment in the
NpgsqlConnectionStringBuilder initialization at line 438 only uses
EncryptionHandler.DecryptwithKey(PassCalculated) without a fallback, causing
authentication to fail if decryption returns an empty string even when
PassCalculated contains valid plaintext. Modify the Password assignment to
implement a fallback pattern where if the decrypted result is empty or null, use
PassCalculated as the plaintext password instead. Reference the existing
fallback pattern already implemented in the ReplacePasswordInConnectionString()
method to ensure consistency across the codebase.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ebab6f75-d022-4498-be81-1c9109e69e33

📥 Commits

Reviewing files that changed from the base of the PR and between bd9750a and 8a7812e.

📒 Files selected for processing (1)
  • Ginger/GingerCoreNET/Database/DatabaseOperations.cs

Comment thread Ginger/GingerCoreNET/Database/DatabaseOperations.cs
@rathimayur
rathimayur enabled auto-merge June 16, 2026 18:59
@rathimayur
rathimayur disabled auto-merge June 17, 2026 10:45
@rathimayur
rathimayur enabled auto-merge June 17, 2026 10:46
@rathimayur
rathimayur disabled auto-merge June 17, 2026 10:47
@ravirk91
ravirk91 merged commit dc1207d into master Jun 17, 2026
11 checks passed
@ravirk91
ravirk91 deleted the PostgresConnectionString-Fix---Master branch June 17, 2026 10:49
@coderabbitai coderabbitai Bot mentioned this pull request Jun 17, 2026
15 tasks
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