From 3174d69fb96a66173224e60ec7053b988d5ed4d9 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 4 Mar 2021 10:45:55 +0200 Subject: 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 --- doc/src/sgml/libpq.sgml | 79 ++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 63 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index cc20b0f234a..05532793142 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -2274,20 +2274,6 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName); cannot change after startup. - - Pre-3.0-protocol servers do not report parameter settings, but - libpq includes logic to obtain values for - server_version and client_encoding anyway. - Applications are encouraged to use - rather than ad hoc code to determine these values. - (Beware however that on a pre-3.0 connection, changing - client_encoding via SET after connection - startup will not be reflected by .) - For server_version, see also - , which returns the information in a - numeric form that is much easier to compare against. - - If no value for standard_conforming_strings is reported, applications can assume it is off, that is, backslashes @@ -2314,15 +2300,12 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName); int PQprotocolVersion(const PGconn *conn); Applications might wish to use this function to determine whether certain - features are supported. Currently, the possible values are 2 (2.0 - protocol), 3 (3.0 protocol), or zero (connection bad). The - protocol version will + features are supported. Currently, the possible values are 3 + (3.0 protocol), or zero (connection bad). The protocol version will not change after connection startup is complete, but it could - theoretically change during a connection reset. The 3.0 protocol - will normally be used when communicating with - PostgreSQL 7.4 or later servers; pre-7.4 servers - support only protocol 2.0. (Protocol 1.0 is obsolete and not - supported by libpq.) + theoretically change during a connection reset. The 3.0 protocol is + supported by PostgreSQL server versions 7.4 + and above. @@ -2739,8 +2722,7 @@ PGresult *PQexecParams(PGconn *conn, is like , but offers additional functionality: parameter values can be specified separately from the command string proper, and query results can be requested in either text or binary - format. is supported only in protocol 3.0 and later - connections; it will fail when using protocol 2.0. + format. @@ -2917,8 +2899,6 @@ PGresult *PQprepare(PGconn *conn, execution with . This feature allows commands to be executed repeatedly without being parsed and planned each time; see for details. - is supported only in protocol 3.0 and later - connections; it will fail when using protocol 2.0. @@ -2992,9 +2972,7 @@ PGresult *PQexecPrepared(PGconn *conn, This feature allows commands that will be used repeatedly to be parsed and planned just once, rather than each time they are executed. The statement must have been prepared previously in - the current session. is supported - only in protocol 3.0 and later connections; it will fail when - using protocol 2.0. + the current session. @@ -3021,8 +2999,6 @@ PGresult *PQdescribePrepared(PGconn *conn, const char *stmtName); allows an application to obtain information about a previously prepared statement. - is supported only in protocol 3.0 - and later connections; it will fail when using protocol 2.0. @@ -3059,8 +3035,6 @@ PGresult *PQdescribePortal(PGconn *conn, const char *portalName); (libpq does not provide any direct access to portals, but you can use this function to inspect the properties of a cursor created with a DECLARE CURSOR SQL command.) - is supported only in protocol 3.0 - and later connections; it will fail when using protocol 2.0. @@ -3566,8 +3540,6 @@ char *PQresultErrorField(const PGresult *res, int fieldcode); Errors generated internally by libpq will have severity and primary message, but typically no other fields. - Errors returned by a pre-3.0-protocol server will include severity and - primary message, and sometimes a detail message, but no other fields. @@ -3728,8 +3700,7 @@ Oid PQftable(const PGresult *res, InvalidOid is returned if the column number is out of range, - or if the specified column is not a simple reference to a table column, - or when using pre-3.0 protocol. + or if the specified column is not a simple reference to a table column. You can query the system table pg_class to determine exactly which table is referenced. @@ -3759,8 +3730,7 @@ int PQftablecol(const PGresult *res, Zero is returned if the column number is out of range, or if the - specified column is not a simple reference to a table column, or - when using pre-3.0 protocol. + specified column is not a simple reference to a table column. @@ -4593,8 +4563,8 @@ int PQsendQueryParams(PGconn *conn, query parameters can be specified separately from the query string. The function's parameters are handled identically to . Like - , it will not work on 2.0-protocol - connections, and it allows only one command in the query string. + , it allows only one command in the + query string. @@ -4619,9 +4589,7 @@ int PQsendPrepare(PGconn *conn, After a successful call, call to determine whether the server successfully created the prepared statement. The function's parameters are handled identically to - . Like - , it will not work on 2.0-protocol - connections. + . @@ -4647,9 +4615,7 @@ int PQsendQueryPrepared(PGconn *conn, the command to be executed is specified by naming a previously-prepared statement, instead of giving a query string. The function's parameters are handled identically to - . Like - , it will not work on - 2.0-protocol connections. + . @@ -4669,9 +4635,7 @@ int PQsendDescribePrepared(PGconn *conn, const char *stmtName); it returns 1 if it was able to dispatch the request, and 0 if not. After a successful call, call to obtain the results. The function's parameters are handled - identically to . Like - , it will not work on - 2.0-protocol connections. + identically to . @@ -4691,9 +4655,7 @@ int PQsendDescribePortal(PGconn *conn, const char *portalName); it returns 1 if it was able to dispatch the request, and 0 if not. After a successful call, call to obtain the results. The function's parameters are handled - identically to . Like - , it will not work on - 2.0-protocol connections. + identically to . @@ -5460,13 +5422,6 @@ typedef struct pgNotify - - - These additional data values are only available when using protocol - 3.0. When using protocol 2.0, all these functions will return 0. - - - Functions for Sending <command>COPY</command> Data @@ -5531,9 +5486,7 @@ int PQputCopyEnd(PGconn *conn, errormsg used as the error message. (One should not assume that this exact error message will come back from the server, however, as the server might have already failed the - COPY for its own reasons. Also note that the option - to force failure does not work when using pre-3.0-protocol - connections.) + COPY for its own reasons.) -- cgit v1.2.3