Skip to content

Commit c276f72

Browse files
fix: revert pgx macaddr fix and pin pgx v5.8.0 to exclude v5.9.x
Pin github.com/jackc/pgx/v5 to v5.8.0 in flow/go.mod and flow/pkg/go.mod with exclude directives blocking v5.9.0–v5.9.2, and add it to the pinned versions checker. Reverts the v5.9 binary-array workaround in qvalue_convert.go — the proper fix will be tackled separately. Co-authored-by: Ilia Demianenko <ilidemi@users.noreply.github.com>
1 parent 45247fe commit c276f72

5 files changed

Lines changed: 15 additions & 26 deletions

File tree

flow/cmd/check_pinned_versions/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var pinnedVersions = map[string]string{
2121
"cloud.google.com/go/pubsub/v2": "v2.3.0",
2222
"cloud.google.com/go/storage": "v1.59.2",
2323
"github.com/aws/aws-sdk-go-v2/feature/s3/manager": "v1.21.0",
24+
"github.com/jackc/pgx/v5": "v5.8.0",
2425
"google.golang.org/api": "v0.257.0",
2526
"github.com/tikv/pd/client": "v0.0.0-20251229071808-6173d50c004c",
2627
}

flow/connectors/postgres/qvalue_convert.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -339,30 +339,6 @@ func (c *PostgresConnector) convertToStringArray(kind types.QValueKind, oid uint
339339
switch v := value.(type) {
340340
case pgtype.Array[string]:
341341
if v.Valid {
342-
// pgx v5.9+ may return binary-encoded elements (e.g. macaddr as 6 raw bytes).
343-
// Detect this by checking if the array type has a known element codec and
344-
// attempting a binary→text re-scan for each non-empty element.
345-
if t, ok := c.typeMap.TypeForOID(oid); ok {
346-
if ac, ok := t.Codec.(*pgtype.ArrayCodec); ok && ac.ElementType != nil {
347-
elemOID := ac.ElementType.OID
348-
result := make([]string, len(v.Elements))
349-
for i, elem := range v.Elements {
350-
if elem == "" {
351-
continue
352-
}
353-
var s string
354-
if err := c.typeMap.Scan(elemOID, pgtype.BinaryFormatCode, []byte(elem), &s); err == nil {
355-
result[i] = s
356-
} else if elemOID == pgtype.MacaddrOID && len(elem) == 6 {
357-
// Explicit fallback: decode macaddr binary (6 bytes) to "XX:XX:XX:XX:XX:XX"
358-
result[i] = net.HardwareAddr([]byte(elem)).String()
359-
} else {
360-
result[i] = elem
361-
}
362-
}
363-
return result, nil
364-
}
365-
}
366342
return v.Elements, nil
367343
}
368344
case []string:

flow/go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ require (
3636
github.com/hamba/avro/v2 v2.31.0
3737
github.com/jackc/pgerrcode v0.0.0-20250907135507-afb5586c32a6
3838
github.com/jackc/pglogrepl v0.0.0-20260401131349-e37c41485510
39-
github.com/jackc/pgx/v5 v5.9.2
39+
github.com/jackc/pgx/v5 v5.8.0 // PINNED: v5.9.0+ decodes macaddr array elements as raw bytes in binary protocol
4040
github.com/joho/godotenv v1.5.1
4141
github.com/json-iterator/go v1.1.12
4242
github.com/lestrrat-go/httprc/v3 v3.0.5
@@ -311,6 +311,9 @@ replace github.com/PeerDB-io/peerdb/flow/pkg => ./pkg
311311

312312
// Block MVS from raising require minima above the pinned versions in the require block — append new releases here until unpinned.
313313
exclude (
314+
github.com/jackc/pgx/v5 v5.9.0
315+
github.com/jackc/pgx/v5 v5.9.1
316+
github.com/jackc/pgx/v5 v5.9.2
314317
cloud.google.com/go/storage v1.60.0
315318
cloud.google.com/go/storage v1.61.0
316319
cloud.google.com/go/storage v1.62.0

flow/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI
504504
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
505505
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
506506
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
507+
github.com/jackc/pgx/v5 v5.8.0 h1:TYPDoleBBme0xGSAX3/+NujXXtpZn9HBONkQC7IEZSo=
508+
github.com/jackc/pgx/v5 v5.8.0/go.mod h1:QVeDInX2m9VyzvNeiCJVjCkNFqzsNb43204HshNSZKw=
507509
github.com/jackc/pgx/v5 v5.9.1 h1:uwrxJXBnx76nyISkhr33kQLlUqjv7et7b9FjCen/tdc=
508510
github.com/jackc/pgx/v5 v5.9.1/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
509511
github.com/jackc/pgx/v5 v5.9.2 h1:3ZhOzMWnR4yJ+RW1XImIPsD1aNSz4T4fyP7zlQb56hw=

flow/pkg/go.mod

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/ClickHouse/ch-go v0.71.0
77
github.com/ClickHouse/clickhouse-go/v2 v2.45.0
88
github.com/go-mysql-org/go-mysql v1.14.0
9-
github.com/jackc/pgx/v5 v5.9.2
9+
github.com/jackc/pgx/v5 v5.8.0 // PINNED: v5.9.0+ decodes macaddr array elements as raw bytes in binary protocol
1010
github.com/stretchr/testify v1.11.1
1111
go.mongodb.org/mongo-driver/v2 v2.6.0
1212
go.temporal.io/sdk v1.42.0
@@ -64,3 +64,10 @@ require (
6464
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
6565
gopkg.in/yaml.v3 v3.0.1 // indirect
6666
)
67+
68+
// Block MVS from raising require minima above the pinned versions in the require block — append new releases here until unpinned.
69+
exclude (
70+
github.com/jackc/pgx/v5 v5.9.0
71+
github.com/jackc/pgx/v5 v5.9.1
72+
github.com/jackc/pgx/v5 v5.9.2
73+
)

0 commit comments

Comments
 (0)