Can't connect Azure Postgresql and error received unexpected message
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 14.3k
- Forks
- 1.1k
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 11
Description
I don't know why 'received unexpected message' or your not suppport azure?
```
package main
import (
"context"
"fmt"
"os"
"github.com/jackc/pgx/v4"
)
func main() {
conn, err := pgx.Connect(context.Background(), "postgresql://xxxxx@cg-x-x-nonprd:xxxxxxxx@cg-x-x-nonprd.postgres.database.azure.com:5432/abcd?sslmode=require")
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
os.Exit(1)
}
defer conn.Close(context.Background())
var greeting string
err = conn.QueryRow(context.Background(), "select 'Hello, world!'").Scan(&greeting)
if err != nil {
fmt.Fprintf(os.Stderr, "QueryRow failed: %v\n", err)
os.Exit(1)
}
fmt.Println(greeting)
}
```
```
λ go run pgx.go
Unable to connect to database: failed to connect to `host=cg-x-x-nonprd.postgres.database.azure.com user=xxxxx@cg-x-x-nonprd database=abcd`: received unexpected message
exit status 1
```
Ref version
`go 1.16.4`
`windows 10`
`Azure Postgresql 11`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pgx.go reproduction and the pgx.Connect call, using the supplied Azure PostgreSQL 11 connection details and error output. Confirm whether the failure is specific to Azure or the connection configuration, and document a verified diagnosis or a minimal reproducible case as done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100