Open thedolphin opened 2 days ago
Describe the bug
target_session_attrs cannot be used with replication connection
To Reproduce
config, _ := pgconn.ParseConfig("target_session_attrs=read-write") config.RuntimeParams["replication"] = "database" pgConn, err := pgconn.ConnectConfig(ctx, config) if err != nil { log.Print(err) }
Expected behavior
Primary server was found and connection succeeded
Actual behavior
ValidateConnect failed: ERROR: extended query protocol not supported in a replication connection (SQLSTATE 08P01)
Version
go version go1.22.7 linux/amd64
github.com/jackc/pgx/v5 v5.7.1
Additional context
Seems that ExecParams in ValidateConnectTargetSessionAttrs* functions is redundant and could be replaced with Exec function, while it triggers extended query protocol usage https://github.com/jackc/pgx/blob/b9e2b20fb13a7eb8e6bf105c074c291b349b6dec/pgconn/config.go#L864
ExecParams
ValidateConnectTargetSessionAttrs*
Exec
Describe the bug
target_session_attrs cannot be used with replication connection
To Reproduce
Expected behavior
Primary server was found and connection succeeded
Actual behavior
Version
go version go1.22.7 linux/amd64
github.com/jackc/pgx/v5 v5.7.1
Additional context
Seems that
ExecParams
inValidateConnectTargetSessionAttrs*
functions is redundant and could be replaced withExec
function, while it triggers extended query protocol usage https://github.com/jackc/pgx/blob/b9e2b20fb13a7eb8e6bf105c074c291b349b6dec/pgconn/config.go#L864