-
Notifications
You must be signed in to change notification settings - Fork 39
fix(ers): use pgx database/sql driver in SQL ERS provider #3543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ryanulit
merged 14 commits into
main
from
fix/ers-sql-provider-register-postgres-driver
Jul 28, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0e6d58f
fix(ers): lazily register database/sql driver in SQL ERS provider
jp-ayyappan b0df6b9
fix(ers): normalize driver name to lowercase before registration checks
jp-ayyappan d8ed893
fix(ers): normalize config.Driver in NewProvider before sql.Open
jp-ayyappan aa544af
fix(ers): satisfy SQL provider lint
jp-ayyappan c0d9847
fix(ers): require exact SQL driver precheck
jp-ayyappan c381db9
Update service/entityresolution/multi-strategy/providers/sql/sql_prov…
jp-ayyappan 76973fd
fix(ers): remove malformed provider declaration
jp-ayyappan f3d98b2
fix(ers): default sql provider to pgx driver
jp-ayyappan 647473a
fix(ers): extract postgres driver aliases
jp-ayyappan 8a9faeb
fix(ers): use versioned pgx sql driver
jp-ayyappan 8386557
fix(ers): rely on pgx stdlib driver registration
jp-ayyappan f72b3c4
test(ers): cover mysql driver passthrough
jp-ayyappan 0d90cdb
fix(ers): keep postgres as sql config default
jp-ayyappan 1799acd
Merge branch 'main' into fix/ers-sql-provider-register-postgres-driver
ryanulit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
service/entityresolution/multi-strategy/providers/sql/sql_config_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| package sql | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestDefaultConfigUsesPostgreSQLDriver(t *testing.T) { | ||
| config := DefaultConfig() | ||
| require.Equal(t, defaultPostgreSQLDriver, config.Driver) | ||
| } | ||
|
|
||
| func TestNormalizeDriverName(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| driver string | ||
| want string | ||
| }{ | ||
| { | ||
| name: "pgx", | ||
| driver: pgxDriverAlias, | ||
| want: canonicalPGXDriver, | ||
| }, | ||
| { | ||
| name: "postgres default", | ||
| driver: defaultPostgreSQLDriver, | ||
| want: canonicalPGXDriver, | ||
| }, | ||
| { | ||
| name: "postgresql alias with whitespace and case", | ||
| driver: " PostgreSQL ", | ||
| want: canonicalPGXDriver, | ||
| }, | ||
| { | ||
| name: "other driver", | ||
| driver: "mysql", | ||
| want: "mysql", | ||
| }, | ||
| { | ||
| name: "sqlite driver", | ||
| driver: "sqlite3", | ||
| want: "sqlite3", | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| require.Equal(t, tt.want, normalizeDriverName(tt.driver)) | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestBuildConnectionStringSupportsPostgresAliases(t *testing.T) { | ||
| tests := []string{canonicalPGXDriver, defaultPostgreSQLDriver, pgxDriverAlias, postgresQLDriverAlias, "Postgres"} | ||
|
|
||
| for _, driver := range tests { | ||
| t.Run(driver, func(t *testing.T) { | ||
| provider := &Provider{ | ||
| config: Config{ | ||
| Driver: driver, | ||
| Host: "localhost", | ||
| Port: 5432, | ||
| Database: "identity_db", | ||
| Username: "ers_user", | ||
| Password: "ers_password", | ||
| SSLMode: "require", | ||
| }, | ||
| } | ||
|
|
||
| connStr, err := provider.buildConnectionString() | ||
| require.NoError(t, err) | ||
| require.Contains(t, connStr, "dbname=identity_db") | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.