Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target_session_attrs cannot be used with replication connection #2168

Open
thedolphin opened this issue Nov 19, 2024 · 0 comments · May be fixed by #2169
Open

target_session_attrs cannot be used with replication connection #2168

thedolphin opened this issue Nov 19, 2024 · 0 comments · May be fixed by #2169
Labels

Comments

@thedolphin
Copy link

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: go version go1.22.7 linux/amd64
  • PostgreSQL: 16
  • pgx: 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

result := pgConn.ExecParams(ctx, "show transaction_read_only", nil, nil, nil, nil).Read()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant