Skip to content

Commit a48b487

Browse files
authored
chore: upgrade to pgx v5.2.0 (cloudnative-pg#1149)
Closes: cloudnative-pg#1147 Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
1 parent 907fe17 commit a48b487

File tree

13 files changed

+24
-127
lines changed

13 files changed

+24
-127
lines changed

go.mod

+3-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/go-logr/logr v1.2.3
1212
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
1313
github.com/google/uuid v1.3.0
14-
github.com/jackc/pgx/v4 v4.17.2
14+
github.com/jackc/pgx/v5 v5.2.0
1515
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
1616
github.com/lib/pq v1.10.7
1717
github.com/logrusorgru/aurora/v3 v3.0.0
@@ -75,13 +75,8 @@ require (
7575
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
7676
github.com/imdario/mergo v0.3.12 // indirect
7777
github.com/inconshreveable/mousetrap v1.0.1 // indirect
78-
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
79-
github.com/jackc/pgconn v1.13.0 // indirect
80-
github.com/jackc/pgio v1.0.0 // indirect
8178
github.com/jackc/pgpassfile v1.0.0 // indirect
82-
github.com/jackc/pgproto3/v2 v2.3.1 // indirect
8379
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
84-
github.com/jackc/pgtype v1.12.0 // indirect
8580
github.com/josharian/intern v1.0.0 // indirect
8681
github.com/json-iterator/go v1.1.12 // indirect
8782
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
@@ -97,10 +92,11 @@ require (
9792
github.com/prometheus/client_model v0.3.0 // indirect
9893
github.com/prometheus/common v0.37.0 // indirect
9994
github.com/prometheus/procfs v0.8.0 // indirect
95+
github.com/rogpeppe/go-internal v1.9.0 // indirect
10096
github.com/xlab/treeprint v1.1.0 // indirect
10197
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
10298
go.uber.org/multierr v1.6.0 // indirect
103-
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
99+
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
104100
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
105101
golang.org/x/term v0.3.0 // indirect
106102
golang.org/x/text v0.5.0 // indirect

go.sum

+8-107
Large diffs are not rendered by default.

internal/cmd/manager/instance/run/lifecycle/run.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"fmt"
2323
"os"
2424

25-
"github.com/jackc/pgx/v4"
25+
"github.com/jackc/pgx/v5"
2626

2727
apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"
2828
"github.com/cloudnative-pg/cloudnative-pg/pkg/fileutils"

internal/management/controller/instance_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"strconv"
2828
"time"
2929

30-
"github.com/jackc/pgx/v4"
30+
"github.com/jackc/pgx/v5"
3131
"github.com/lib/pq"
3232
corev1 "k8s.io/api/core/v1"
3333
apierrors "k8s.io/apimachinery/pkg/api/errors"

pkg/management/postgres/backup.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import (
4646
"github.com/cloudnative-pg/cloudnative-pg/pkg/utils"
4747

4848
// this is needed to correctly open the sql connection with the pgx driver
49-
_ "github.com/jackc/pgx/v4/stdlib"
49+
_ "github.com/jackc/pgx/v5/stdlib"
5050
)
5151

5252
// We wait up to 10 minutes to have a WAL archived correctly

pkg/management/postgres/initdb.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"path/filepath"
3030
"sort"
3131

32-
"github.com/jackc/pgx/v4"
32+
"github.com/jackc/pgx/v5"
3333
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
3434

3535
apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"

pkg/management/postgres/instance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import (
4545
"github.com/cloudnative-pg/cloudnative-pg/pkg/specs"
4646

4747
// this is needed to correctly open the sql connection with the pgx driver
48-
_ "github.com/jackc/pgx/v4/stdlib"
48+
_ "github.com/jackc/pgx/v5/stdlib"
4949
)
5050

5151
const (

pkg/management/postgres/join.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/cloudnative-pg/cloudnative-pg/pkg/utils"
2727

2828
// this is needed to correctly open the sql connection with the pgx driver
29-
_ "github.com/jackc/pgx/v4/stdlib"
29+
_ "github.com/jackc/pgx/v5/stdlib"
3030
)
3131

3232
// ClonePgData clones an existing server, given its connection string,

pkg/management/postgres/logicalimport/database.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"fmt"
2222
"os/exec"
2323

24-
"github.com/jackc/pgx/v4"
24+
"github.com/jackc/pgx/v5"
2525
"k8s.io/utils/strings/slices"
2626

2727
apiv1 "github.com/cloudnative-pg/cloudnative-pg/api/v1"

pkg/management/postgres/logicalimport/role.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"fmt"
2323

2424
"github.com/blang/semver"
25-
"github.com/jackc/pgx/v4"
25+
"github.com/jackc/pgx/v5"
2626
"github.com/lib/pq"
2727
"k8s.io/utils/strings/slices"
2828

pkg/management/postgres/logicalimport/roleinheritance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121
"fmt"
2222

23-
"github.com/jackc/pgx/v4"
23+
"github.com/jackc/pgx/v5"
2424

2525
"github.com/cloudnative-pg/cloudnative-pg/pkg/management/log"
2626
"github.com/cloudnative-pg/cloudnative-pg/pkg/management/postgres/pool"

pkg/management/postgres/pool/pool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/cloudnative-pg/cloudnative-pg/pkg/utils"
2626

2727
// this is needed to correctly open the sql connection with the pgx driver
28-
_ "github.com/jackc/pgx/v4/stdlib"
28+
_ "github.com/jackc/pgx/v5/stdlib"
2929
)
3030

3131
// ConnectionPool is a repository of DB connections, pointing to the same instance

pkg/utils/db.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ package utils
1919
import (
2020
"database/sql"
2121

22-
"github.com/jackc/pgx/v4"
22+
"github.com/jackc/pgx/v5"
2323
// this is needed to correctly open the sql connection with the pgx driver. Do not remove this import.
24-
"github.com/jackc/pgx/v4/stdlib"
24+
"github.com/jackc/pgx/v5/stdlib"
2525
)
2626

2727
// NewSimpleDBConnection creates a postgres connection with the simple protocol
@@ -34,7 +34,7 @@ func NewSimpleDBConnection(connectionString string) (*sql.DB, error) {
3434
// The simple query protocol is needed since we're going to use
3535
// this function to connect to the PgBouncer administrative
3636
// interface, which doesn't support the extended one.
37-
conf.PreferSimpleProtocol = true
37+
conf.DefaultQueryExecMode = pgx.QueryExecModeSimpleProtocol
3838

3939
// This is required by pgx when using the simple protocol during
4040
// the sanitization of the strings. Do not remove.

0 commit comments

Comments
 (0)