Skip to content

multi-strategy ERS SQL provider should register its own database/sql driver #3539

Description

@jp-ayyappan

Summary

The multi-strategy ERS SQL provider (service/entityresolution/multi-strategy/providers/sql/sql_provider.go) calls sql.Open(config.Driver, connStr) which requires the named driver to be pre-registered via a blank import. The provider source acknowledges this with a comment:

```go
// Database drivers would be imported here:
// _ "github.com/lib/pq" // PostgreSQL driver
// _ "github.com/go-sql-driver/mysql" // MySQL driver
// _ "github.com/mattn/go-sqlite3" // SQLite driver
```

This design delegates driver registration to every consumer of the package. For the DSP platform, this means adding `_ "github.com/lib/pq"` in `main.go` — a side-effect that affects the entire binary even for users who never use the SQL ERS tier.

Suggested fix

Register the driver inside the SQL provider's own `init()` or `NewProvider()` function, or document a supported pattern for lazy/conditional registration. The LDAP and claims providers have no equivalent external dependency, so this inconsistency is surprising for consumers.

Context

Discovered while implementing a multi-strategy ERS reference implementation in the Virtru Data Security Platform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions