[v11.0.x] Revert "Postgres: Switch the datasource plugin from lib/pq to pgx (#8… (#85517)

Revert "Postgres: Switch the datasource plugin from lib/pq to pgx (#8… (#85509)

Revert "Postgres: Switch the datasource plugin from lib/pq to pgx (#83768)"

This reverts commit ecd6de826a.

(cherry picked from commit 8159e1db3a)

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-04-03 12:54:57 +02:00
committed by GitHub
parent 0c10923304
commit ae73f31cf1
17 changed files with 943 additions and 1078 deletions
@@ -1,12 +1,12 @@
package postgres
import (
"database/sql"
"fmt"
"net"
"testing"
"github.com/jackc/pgx/v5"
pgxstdlib "github.com/jackc/pgx/v5/stdlib"
"github.com/lib/pq"
"github.com/stretchr/testify/require"
"golang.org/x/net/proxy"
)
@@ -25,13 +25,13 @@ func TestPostgresProxyDriver(t *testing.T) {
cnnstr := fmt.Sprintf("postgres://auser:password@%s/db?sslmode=disable", dbURL)
t.Run("Connector should use dialer context that routes through the socks proxy to db", func(t *testing.T) {
pgxConf, err := pgx.ParseConfig(cnnstr)
connector, err := pq.NewConnector(cnnstr)
require.NoError(t, err)
dialer := newPostgresProxyDialer(&testDialer{})
pgxConf.DialFunc = newPgxDialFunc(&testDialer{})
db := pgxstdlib.OpenDB(*pgxConf)
connector.Dialer(dialer)
db := sql.OpenDB(connector)
err = db.Ping()
require.Contains(t, err.Error(), "test-dialer is not functional")