Version
github.com/jmoiron/sqlx v1.4.0
Summary
sqlx.Named appears to misparse PostgreSQL cast syntax when it is attached directly to a named parameter, for example :boundary::jsonb.
Actual Behavior
The call returns:
err=unexpected ':' while reading named param at 16
Expected Behavior
The query should bind successfully, preserving the PostgreSQL cast, producing something equivalent to:
SELECT ?::jsonb AS boundary, '2026-05-01'::timestamptz AS starts_at;
with one bound argument for boundary.
Minimal Reproduction
package main
import (
"fmt"
"github.com/jmoiron/sqlx"
)
func main() {
query := "SELECT :boundary::jsonb AS boundary, '2026-05-01'::timestamptz AS starts_at;"
q, args, err := sqlx.Named(query, map[string]any{
"boundary": `{"type":"Polygon","coordinates":[]}`,
})
fmt.Printf("query=%q\nargs=%#v\nerr=%v\n", q, args, err)
}
Version
github.com/jmoiron/sqlx v1.4.0Summary
sqlx.Namedappears to misparse PostgreSQL cast syntax when it is attached directly to a named parameter, for example:boundary::jsonb.Actual Behavior
The call returns:
err=unexpected ':' while reading named param at 16
Expected Behavior
The query should bind successfully, preserving the PostgreSQL cast, producing something equivalent to:
SELECT ?::jsonb AS boundary, '2026-05-01'::timestamptz AS starts_at;
with one bound argument for boundary.
Minimal Reproduction