Skip to content
AdminKit

PostgreSQL wire protocol

What is PostgreSQL wire protocol?

The PostgreSQL wire protocol is the message format a client uses to connect, authenticate and query over TCP, normally on port 5432, documented as PostgreSQL's own frontend/backend protocol. AdminKit's guide checks whether your own PostgreSQL port 5432 is reachable from the internet, since the default binds only to localhost.

By AdminKit team, Netbase JSC · Updated

The PostgreSQL wire protocol, documented as the “frontend/backend protocol” in PostgreSQL’s own manual, is the message format a client or driver uses to open a connection, authenticate, send queries and receive results over TCP, normally on port 5432, the port IANA registers for PostgreSQL. It’s a protocol specific to PostgreSQL rather than an open, cross-database standard, which is why a MySQL or MongoDB driver can’t speak to a PostgreSQL server directly. Because it is publicly documented, other tools can decode it too: the Wireshark wiki’s PostgresProtocol page describes Wireshark’s pgsql dissector for this v3 frontend/backend protocol, used by PostgreSQL 7.4 and later. Because the protocol itself doesn’t enforce where a server listens, PostgreSQL’s security depends on two separate settings working together: listen_addresses, which controls which network interfaces the server binds to, and pg_hba.conf, which controls who may authenticate once a connection reaches it. For password logins, the protocol’s authentication exchange supports SCRAM-SHA-256, the SASL mechanism specified in RFC 7677, which lets a client prove it knows the password without sending it in cleartext. PostgreSQL defaults to listening on localhost only, so a server reachable on 5432 from the internet means that default was deliberately changed.

PostgreSQL wire protocol is part of AdminKit’s machine protocols cluster; the full AdminKit glossary lists other related terms.

Frequently asked questions

What port does the PostgreSQL wire protocol normally use?

TCP port 5432, the port IANA registers for PostgreSQL.

Can a MySQL or MongoDB driver talk to a PostgreSQL server directly?

No -- PostgreSQL's wire protocol is specific to PostgreSQL rather than an open, cross-database standard.

What two settings control PostgreSQL's network exposure?

listen_addresses, which controls which interfaces the server binds to, and pg_hba.conf, which controls who may authenticate once a connection reaches it.

Does PostgreSQL listen on the network by default?

No -- it defaults to localhost only, so a server reachable on 5432 from the internet means that default was deliberately changed.