Skip to content
This repository was archived by the owner on Jul 12, 2025. It is now read-only.
This repository was archived by the owner on Jul 12, 2025. It is now read-only.

Received unexpected message #102

Description

@mixmind

Hi,

I faced with issue that driver dont know what to do with warnings that postgres backend throws during connection. Psql works fine, nothing shows and with pgx I'm having trouble to connect at all.

pgconn.go line 326 was changed to this

default:
pgConn.conn.Close()
fmt.Printf("%+v,%T", msg, msg)
return nil, &connectError{config: config, msg: "received unexpected message", err: err}

When i changed code to print what is going on, i received such message

results
&{Severity:WARNING SeverityUnlocalized:WARNING Code:01000 Message:1 temporary files and directories not closed at end-of-transaction Detail: Hint: Position:0 InternalPosition:0 InternalQuery: Where: SchemaName: TableName: ColumnName: DataTypeName: ConstraintName: File:fd.c Line:3021 Routine:CleanupTempFiles UnknownFields:map[]},*pgproto3.NoticeResponseUnable to connect to database: failed to connect to `host=/var/run/postgresql user=postgres database=postgres`: received unexpected message

Can it be handled without error from pgx side?

It can be repsoduced if postgresql parameter will be changed to client_min_messages = debug5 , every connect to db will fail with such error : received unexpected message

example of response with config changed to debug5

results
{"Severity":"DEBUG","SeverityUnlocalized":"DEBUG","Code":"00000","Message":"CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: 0/1/0","Detail":"","Hint":"","Position":0,"InternalPosition":0,"InternalQuery":"","Where":"","SchemaName":"","TableName":"","ColumnName":"","DataTypeName":"","ConstraintName":"","File":"xact.c","Line":5182,"Routine":"ShowTransactionStateRec","UnknownFields":null}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions