Skip to content

sql/postgres: Compatibility with pgx #1415

Description

@mikeclarke

The DriverName is hardcoded to "postgres", which makes using Atlas with pgx tricky since that library registers with the name "pgx" (instead of "postgres" as lib/pq does). I hit this in the context of using versioned migrations with ent. One workaround was to re-register pgx as "postgres", which might cause some confusion for folks.

import (
	"database/sql"
	pgx "github.com/jackc/pgx/v5/stdlib"
)

pgxDriver := pgx.GetDefaultDriver()
sql.Register("postgres", pgxDriver)

I'm not sure how other libraries are dealing with this since it seems like a common issue, but thought I'd flag in case it was helpful. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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