package proto

import "github.com/lib/pq/internal/proto"

Index

Constants

const (
	ProtocolVersion30 = (3 << 16) | 0 //lint:ignore SA4016 x
	ProtocolVersion32 = (3 << 16) | 2 // PostgreSQL ≥18.
	CancelRequestCode = (1234 << 16) | 5678
	NegotiateSSLCode  = (1234 << 16) | 5679
	NegotiateGSSCode  = (1234 << 16) | 5680
)

Constants from pqcomm.h

const (
	Bind                = RequestCode('B')
	Close               = RequestCode('C')
	Describe            = RequestCode('D')
	Execute             = RequestCode('E')
	FunctionCall        = RequestCode('F')
	Flush               = RequestCode('H')
	Parse               = RequestCode('P')
	Query               = RequestCode('Q')
	Sync                = RequestCode('S')
	Terminate           = RequestCode('X')
	CopyFail            = RequestCode('f')
	GSSResponse         = RequestCode('p')
	PasswordMessage     = RequestCode('p')
	SASLInitialResponse = RequestCode('p')
	SASLResponse        = RequestCode('p')
	CopyDoneRequest     = RequestCode('c')
	CopyDataRequest     = RequestCode('d')
)

These are the request codes sent by the frontend.

const (
	ParseComplete            = ResponseCode('1')
	BindComplete             = ResponseCode('2')
	CloseComplete            = ResponseCode('3')
	NotificationResponse     = ResponseCode('A')
	CommandComplete          = ResponseCode('C')
	DataRow                  = ResponseCode('D')
	ErrorResponse            = ResponseCode('E')
	CopyInResponse           = ResponseCode('G')
	CopyOutResponse          = ResponseCode('H')
	EmptyQueryResponse       = ResponseCode('I')
	BackendKeyData           = ResponseCode('K')
	NoticeResponse           = ResponseCode('N')
	AuthenticationRequest    = ResponseCode('R')
	ParameterStatus          = ResponseCode('S')
	RowDescription           = ResponseCode('T')
	FunctionCallResponse     = ResponseCode('V')
	CopyBothResponse         = ResponseCode('W')
	ReadyForQuery            = ResponseCode('Z')
	NoData                   = ResponseCode('n')
	PortalSuspended          = ResponseCode('s')
	ParameterDescription     = ResponseCode('t')
	NegotiateProtocolVersion = ResponseCode('v')
	CopyDoneResponse         = ResponseCode('c')
	CopyDataResponse         = ResponseCode('d')
)

These are the response codes sent by the backend.

const (
	AuthReqOk       = AuthCode(0) // User is authenticated
	AuthReqKrb4     = AuthCode(1) // Kerberos V4. Not supported any more.
	AuthReqKrb5     = AuthCode(2) // Kerberos V5. Not supported any more.
	AuthReqPassword = AuthCode(3) // Password
	AuthReqCrypt    = AuthCode(4) // crypt password. Not supported any more.
	AuthReqMD5      = AuthCode(5) // md5 password

	AuthReqGSS      = AuthCode(7)  // GSSAPI without wrap()
	AuthReqGSSCont  = AuthCode(8)  // Continue GSS exchanges
	AuthReqSSPI     = AuthCode(9)  // SSPI negotiate without wrap()
	AuthReqSASL     = AuthCode(10) // Begin SASL authentication
	AuthReqSASLCont = AuthCode(11) // Continue SASL authentication
	AuthReqSASLFin  = AuthCode(12) // Final SASL message
)

These are the authentication request codes sent by the backend.

const (
	MaxErrlen = 30_000 // https://github.com/postgres/postgres/blob/c6a10a89f/src/interfaces/libpq/fe-connect.c#L4067
)

Constants from fe-connect.c

const MaxUint32 = math.MaxUint32

Types

type AuthCode

type AuthCode int32

AuthCode are authentication request codes sent by the backend.

func (AuthCode) String

func (a AuthCode) String() string

type RequestCode

type RequestCode byte

RequestCode is a request codes sent by the frontend.

func (RequestCode) String

func (r RequestCode) String() string

type ResponseCode

type ResponseCode byte

ResponseCode is a response codes sent by the backend.

func (ResponseCode) String

func (r ResponseCode) String() string

Source Files

proto.go sz_64.go

Version
v1.12.2
Published
Apr 2, 2026
Platform
linux/amd64
Imports
3 packages
Last checked
1 minute ago

Tools for package owners.