Skip to content

fix: Ensure appropriate quoting for case sensitive tenant names#101

Merged
bartventer merged 2 commits intomasterfrom
issue100/quoting
Jul 11, 2025
Merged

fix: Ensure appropriate quoting for case sensitive tenant names#101
bartventer merged 2 commits intomasterfrom
issue100/quoting

Conversation

@bartventer
Copy link
Copy Markdown
Owner

@bartventer bartventer commented Jul 11, 2025

Fixes case-sensitive tenant name handling in PostgreSQL and MySQL drivers by properly quoting schema and database names in path operations.

Changes

  • postgres/schema/schema.go: Use QuoteTo() in SetSearchPath() function
  • mysql/schema/schema.go: Use QuoteTo() in UseDatabase() function
  • Added test coverage for case-sensitive tenant names to prevent regression (see TestIssue100 comments below)

Fixes #100

@codesandbox
Copy link
Copy Markdown

codesandbox bot commented Jul 11, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@bartventer
Copy link
Copy Markdown
Owner Author

bartventer commented Jul 11, 2025

Fixes case-sensitive tenant name handling by using GORM's `QuoteTo` method instead of string concatenation for `SET search_path` and `USE` statements.
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 11, 2025

Codecov Report

Attention: Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 81.25%. Comparing base (078c244) to head (a14456b).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
mysql/schema/schema.go 71.42% 1 Missing and 1 partial ⚠️
postgres/schema/schema.go 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
+ Coverage   81.22%   81.25%   +0.02%     
==========================================
  Files          35       35              
  Lines        1273     1275       +2     
==========================================
+ Hits         1034     1036       +2     
  Misses        190      190              
  Partials       49       49              
Flag Coverage Δ
combined 81.25% <73.33%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bartventer bartventer marked this pull request as ready for review July 11, 2025 14:03
Copy link
Copy Markdown
Owner Author

@bartventer bartventer left a comment

Choose a reason for hiding this comment

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

Reviewed and approved.

@bartventer bartventer merged commit 299acc6 into master Jul 11, 2025
16 checks passed
@bartventer bartventer deleted the issue100/quoting branch July 11, 2025 14:09
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.

postgres: Case sensitive Tenant names are not processed correctly

1 participant