Removing support for COPY FROM STDIN in protocol version 2
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-02-03T15:43:47Z
Lists: pgsql-hackers
Attachments
Hi, The server still supports the old protocol version 2. Protocol version 3 was introduced in PostgreSQL 7.4, so there shouldn't be many clients around anymore that don't support it. COPY FROM STDIN is particularly problematic with the old protocol, because the end-of-copy can only be detected by the \. marker. So the server has to read the input one byte at a time, and check for \. as it goes. At [1], I'm working on a patch to change the way the encoding conversion is performed in COPY FROM, so that we convert the data in larger chunks, before scanning the input for line boundaries. We can't do that safely in the old protocol. I propose that we remove server support for COPY FROM STDIN with protocol version 2, per attached patch. Even if we could still support it, it would be a very rarely used and tested codepath, prone to bugs. Perhaps we could remove support for the old protocol altogether, but I'm not proposing that we go that far just yet. [1] https://www.postgresql.org/message-id/e7861509-3960-538a-9025-b75a61188e01%40iki.fi - Heikki
Commits
-
Avoid extra newline in errors received in FE protocol version 2.
- 85d94c575302 14.0 landed
-
Remove server and libpq support for old FE/BE protocol version 2.
- 3174d69fb96a 14.0 landed
-
Handle reading of startup packet and authentication exchange after forking
- 9b4bfbdc2cd7 7.2.1 cited