Skip to content

Commit 30e7c17

Browse files
committed
Remove pg_dump/pg_dumpall support for dumping from pre-9.2 servers.
Per discussion, we'll limit support for old servers to those branches that can still be built easily on modern platforms, which as of now is 9.2 and up. Remove over a thousand lines of code dedicated to dumping from older server versions. (As in previous changes of this sort, we aren't removing pg_restore's ability to read older archive files ... though it's fair to wonder how that might be tested nowadays.) This cleans up some dead code left behind by commit 9895961. Discussion: https://postgr.es/m/2923349.1634942313@sss.pgh.pa.us
1 parent a2ff18e commit 30e7c17

File tree

5 files changed

+417
-1761
lines changed

5 files changed

+417
-1761
lines changed

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -398,16 +398,6 @@ PostgreSQL documentation
398398
different worker jobs wouldn't be guaranteed to see the same data in
399399
each connection, which could lead to an inconsistent backup.
400400
</para>
401-
<para>
402-
If you want to run a parallel dump of a pre-9.2 server, you need to make sure that the
403-
database content doesn't change from between the time the leader connects to the
404-
database until the last worker job has connected to the database. The easiest way to
405-
do this is to halt any data modifying processes (DDL and DML) accessing the database
406-
before starting the backup. You also need to specify the
407-
<option>--no-synchronized-snapshots</option> parameter when running
408-
<command>pg_dump -j</command> against a pre-9.2 <productname>PostgreSQL</productname>
409-
server.
410-
</para>
411401
</listitem>
412402
</varlistentry>
413403

@@ -945,9 +935,10 @@ PostgreSQL documentation
945935
<term><option>--no-synchronized-snapshots</option></term>
946936
<listitem>
947937
<para>
948-
This option allows running <command>pg_dump -j</command> against a pre-9.2
949-
server, see the documentation of the <option>-j</option> parameter
950-
for more details.
938+
This option allows running <command>pg_dump -j</command> against a
939+
pre-v10 standby server, at the cost of possibly producing an
940+
inconsistent dump. See the documentation of the <option>-j</option>
941+
parameter for more details.
951942
</para>
952943
</listitem>
953944
</varlistentry>
@@ -1381,7 +1372,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
13811372
<productname>PostgreSQL</productname> server versions newer than
13821373
<application>pg_dump</application>'s version. <application>pg_dump</application> can also
13831374
dump from <productname>PostgreSQL</productname> servers older than its own version.
1384-
(Currently, servers back to version 8.0 are supported.)
1375+
(Currently, servers back to version 9.2 are supported.)
13851376
However, <application>pg_dump</application> cannot dump from
13861377
<productname>PostgreSQL</productname> servers newer than its own major version;
13871378
it will refuse to even try, rather than risk making an invalid dump.

src/bin/pg_dump/dumputils.c

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,6 @@ buildACLCommands(const char *name, const char *subname, const char *nspname,
227227
appendPQExpBuffer(firstsql, "%s FROM ", name);
228228
if (grantee->len == 0)
229229
appendPQExpBufferStr(firstsql, "PUBLIC;\n");
230-
else if (strncmp(grantee->data, "group ",
231-
strlen("group ")) == 0)
232-
appendPQExpBuffer(firstsql, "GROUP %s;\n",
233-
fmtId(grantee->data + strlen("group ")));
234230
else
235231
appendPQExpBuffer(firstsql, "%s;\n",
236232
fmtId(grantee->data));
@@ -247,14 +243,9 @@ buildACLCommands(const char *name, const char *subname, const char *nspname,
247243
* public privileges are added in new versions: the REVOKE ALL will revoke
248244
* them, leading to behavior different from what the old version had,
249245
* which is generally not what's wanted. So add back default privs if the
250-
* source database is too old to have had that particular priv.
246+
* source database is too old to have had that particular priv. (As of
247+
* right now, no such cases exist in supported versions.)
251248
*/
252-
if (remoteVersion < 80200 && strcmp(type, "DATABASE") == 0)
253-
{
254-
/* database CONNECT priv didn't exist before 8.2 */
255-
appendPQExpBuffer(firstsql, "%sGRANT CONNECT ON %s %s TO PUBLIC;\n",
256-
prefix, type, name);
257-
}
258249

259250
/*
260251
* Scan individual ACL items to be granted.
@@ -306,10 +297,6 @@ buildACLCommands(const char *name, const char *subname, const char *nspname,
306297
appendPQExpBuffer(thissql, "%s TO ", name);
307298
if (grantee->len == 0)
308299
appendPQExpBufferStr(thissql, "PUBLIC;\n");
309-
else if (strncmp(grantee->data, "group ",
310-
strlen("group ")) == 0)
311-
appendPQExpBuffer(thissql, "GROUP %s;\n",
312-
fmtId(grantee->data + strlen("group ")));
313300
else
314301
appendPQExpBuffer(thissql, "%s;\n", fmtId(grantee->data));
315302
}
@@ -322,10 +309,6 @@ buildACLCommands(const char *name, const char *subname, const char *nspname,
322309
appendPQExpBuffer(thissql, "%s TO ", name);
323310
if (grantee->len == 0)
324311
appendPQExpBufferStr(thissql, "PUBLIC");
325-
else if (strncmp(grantee->data, "group ",
326-
strlen("group ")) == 0)
327-
appendPQExpBuffer(thissql, "GROUP %s",
328-
fmtId(grantee->data + strlen("group ")));
329312
else
330313
appendPQExpBufferStr(thissql, fmtId(grantee->data));
331314
appendPQExpBufferStr(thissql, " WITH GRANT OPTION;\n");
@@ -420,16 +403,12 @@ buildDefaultACLCommands(const char *type, const char *nspname,
420403
/*
421404
* This will parse an aclitem string, having the general form
422405
* username=privilegecodes/grantor
423-
* or
424-
* group groupname=privilegecodes/grantor
425-
* (the "group" case occurs only with servers before 8.1).
426406
*
427407
* Returns true on success, false on parse error. On success, the components
428408
* of the string are returned in the PQExpBuffer parameters.
429409
*
430-
* The returned grantee string will be the dequoted username or groupname
431-
* (preceded with "group " in the latter case). Note that a grant to PUBLIC
432-
* is represented by an empty grantee string. The returned grantor is the
410+
* The returned grantee string will be the dequoted username, or an empty
411+
* string in the case of a grant to PUBLIC. The returned grantor is the
433412
* dequoted grantor name. Privilege characters are translated to GRANT/REVOKE
434413
* comma-separated privileges lists. If "privswgo" is non-NULL, the result is
435414
* separate lists for privileges with grant option ("privswgo") and without
@@ -522,8 +501,7 @@ do { \
522501
{
523502
CONVERT_PRIV('d', "DELETE");
524503
CONVERT_PRIV('t', "TRIGGER");
525-
if (remoteVersion >= 80400)
526-
CONVERT_PRIV('D', "TRUNCATE");
504+
CONVERT_PRIV('D', "TRUNCATE");
527505
}
528506
}
529507

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -904,13 +904,10 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool is_parallel)
904904
StartTransaction(&AH->public);
905905

906906
/*
907-
* If the server version is >= 8.4, make sure we issue
908-
* TRUNCATE with ONLY so that child tables are not
909-
* wiped.
907+
* Issue TRUNCATE with ONLY so that child tables are
908+
* not wiped.
910909
*/
911-
ahprintf(AH, "TRUNCATE TABLE %s%s;\n\n",
912-
(PQserverVersion(AH->connection) >= 80400 ?
913-
"ONLY " : ""),
910+
ahprintf(AH, "TRUNCATE TABLE ONLY %s;\n\n",
914911
fmtQualifiedId(te->namespace, te->tag));
915912
}
916913

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy