mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
Remove server and libpq support for old FE/BE protocol version 2.
Protocol version 3 was introduced in PostgreSQL 7.4. There shouldn't be many clients or servers left out there without version 3 support. But as a courtesy, I kept just enough of the old protocol support that we can still send the "unsupported protocol version" error in v2 format, so that old clients can display the message properly. Likewise, libpq still understands v2 ErrorResponse messages when establishing a connection. The impetus to do this now is that I'm working on a patch to COPY FROM, to always prefetch some data. We cannot do that safely with the old protocol, because it requires parsing the input one byte at a time to detect the end-of-copy marker. Reviewed-by: Tom Lane, Alvaro Herrera, John Naylor Discussion: https://www.postgresql.org/message-id/9ec25819-0a8a-d51a-17dc-4150bb3cca3b%40iki.fi
This commit is contained in:
@@ -252,22 +252,6 @@ typedef enum
|
||||
PG_BOOL_NO /* No (false) */
|
||||
} PGTernaryBool;
|
||||
|
||||
/* PGSetenvStatusType defines the state of the pqSetenv state machine */
|
||||
|
||||
/* (this is used only for 2.0-protocol connections) */
|
||||
typedef enum
|
||||
{
|
||||
SETENV_STATE_CLIENT_ENCODING_SEND, /* About to send an Environment Option */
|
||||
SETENV_STATE_CLIENT_ENCODING_WAIT, /* Waiting for above send to complete */
|
||||
SETENV_STATE_OPTION_SEND, /* About to send an Environment Option */
|
||||
SETENV_STATE_OPTION_WAIT, /* Waiting for above send to complete */
|
||||
SETENV_STATE_QUERY1_SEND, /* About to send a status query */
|
||||
SETENV_STATE_QUERY1_WAIT, /* Waiting for query to complete */
|
||||
SETENV_STATE_QUERY2_SEND, /* About to send a status query */
|
||||
SETENV_STATE_QUERY2_WAIT, /* Waiting for query to complete */
|
||||
SETENV_STATE_IDLE
|
||||
} PGSetenvStatusType;
|
||||
|
||||
/* Typedef for the EnvironmentOptions[] array */
|
||||
typedef struct PQEnvironmentOption
|
||||
{
|
||||
@@ -446,8 +430,6 @@ struct pg_conn
|
||||
struct addrinfo *addrlist; /* list of addresses for current connhost */
|
||||
struct addrinfo *addr_cur; /* the one currently being tried */
|
||||
int addrlist_family; /* needed to know how to free addrlist */
|
||||
PGSetenvStatusType setenv_state; /* for 2.0 protocol only */
|
||||
const PQEnvironmentOption *next_eo;
|
||||
bool send_appname; /* okay to send application_name? */
|
||||
|
||||
/* Miscellaneous stuff */
|
||||
@@ -639,22 +621,6 @@ extern void pqSaveParameterStatus(PGconn *conn, const char *name,
|
||||
extern int pqRowProcessor(PGconn *conn, const char **errmsgp);
|
||||
extern int PQsendQueryContinue(PGconn *conn, const char *query);
|
||||
|
||||
/* === in fe-protocol2.c === */
|
||||
|
||||
extern PostgresPollingStatusType pqSetenvPoll(PGconn *conn);
|
||||
|
||||
extern char *pqBuildStartupPacket2(PGconn *conn, int *packetlen,
|
||||
const PQEnvironmentOption *options);
|
||||
extern void pqParseInput2(PGconn *conn);
|
||||
extern int pqGetCopyData2(PGconn *conn, char **buffer, int async);
|
||||
extern int pqGetline2(PGconn *conn, char *s, int maxlen);
|
||||
extern int pqGetlineAsync2(PGconn *conn, char *buffer, int bufsize);
|
||||
extern int pqEndcopy2(PGconn *conn);
|
||||
extern PGresult *pqFunctionCall2(PGconn *conn, Oid fnid,
|
||||
int *result_buf, int *actual_result_len,
|
||||
int result_is_int,
|
||||
const PQArgBlock *args, int nargs);
|
||||
|
||||
/* === in fe-protocol3.c === */
|
||||
|
||||
extern char *pqBuildStartupPacket3(PGconn *conn, int *packetlen,
|
||||
@@ -691,7 +657,7 @@ extern int pqSkipnchar(size_t len, PGconn *conn);
|
||||
extern int pqPutnchar(const char *s, size_t len, PGconn *conn);
|
||||
extern int pqGetInt(int *result, size_t bytes, PGconn *conn);
|
||||
extern int pqPutInt(int value, size_t bytes, PGconn *conn);
|
||||
extern int pqPutMsgStart(char msg_type, bool force_len, PGconn *conn);
|
||||
extern int pqPutMsgStart(char msg_type, PGconn *conn);
|
||||
extern int pqPutMsgEnd(PGconn *conn);
|
||||
extern int pqReadData(PGconn *conn);
|
||||
extern int pqFlush(PGconn *conn);
|
||||
|
||||
Reference in New Issue
Block a user