crate / crate/crate

Support PostgreSQL protocol version 3.2

Open
#19,175 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
4.4k
Forks
616
Avg merge
14h 49m
Merged PRs (30d)
206

Description

### Problem Statement

Hi. It seems like CrateDB does not provide support for PostgreSQL protocol v3.2 yet. According to release notes of pgx authors, that promises a few efficiency improvements:

> It significantly reduces the amount of network traffic when using prepared statements by avoiding unnecessary Describe Portal messages.

#### jdbc
When connecting with jdbc using `jdbc:postgresql://localhost:5432/testdrive?user=crate&protocolVersion=3.2`, the error message is ([CI](https://github.com/crate/cratedb-examples/actions/runs/23501399037/job/68397139003?pr=1507#step:7:6919)):
```
ERROR: org.postgresql.util.PSQLException: Protocol error, received invalid options: _pq_.DateStyle,_pq_.TimeZone
```

#### pgx
When connecting with pgx using `postgres://crate@localhost:5432/testdrive?min_protocol_version=3.2&max_protocol_version=3.2`, the error message is ([CI](https://github.com/crate/cratedb-examples/actions/runs/23468224685/job/68285050488?pr=1494#step:6:18)):
```
failed to connect [...] 127.0.0.1:5432 (localhost): server protocol version too low
```

### References
- GH-18333
- https://github.com/crate/cratedb-examples/pull/1507
- https://github.com/crate/cratedb-examples/pull/1494

### Reproduce

pgx 5.9.0 (* March 21, 2026) now includes the client-side implementation for protocol v3.2, and accompanying options `min_protocol_version` and `max_protocol_version` to define the protocol version when connecting to PostgreSQL. The example below uses those options so you can reproduce the exercise easily.

`example.go`
```go
package main

import (
"context"
"fmt"
"log"
"github.com/jackc/pgx/v5"
)

func main() {
connStr := fmt.Sprintf("postgres://crate@localhost:5432/testdrive?sslmode=disable&min_protocol_version=3.2&max_protocol_version=3.2")
ctx := context.Background()
conn, err := pgx.Connect(ctx, connStr)
if err != nil {
log.Fatal(err)
}
defer conn.Close(ctx)

var mountain string
err = conn.QueryRow(ctx, "select mountain from sys.summits limit 3").Scan(&mountain)
if err != nil {
log.Fatal(err)
}
fmt.Println(mountain)
}
```
```shell
go mod init cratedb.com/go-pgx-test/v2
go mod tidy
go run example.go
```
```
$ go run example.go
2026/03/24 16:15:56 failed to connect to `user=crate database=testdrive`:
[::1]:5432 (localhost): server protocol version too low: %!w()
127.0.0.1:5432 (localhost): server protocol version too low: %!w()
exit status 1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.