Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 64f3524

Browse filesBrowse files
committed
Remove pg_dump/pg_dumpall support for dumping from pre-8.0 servers.
The need for dumping from such ancient servers has decreased to about nil in the field, so let's remove all the code that catered to it. Aside from removing a lot of boilerplate variant queries, this allows us to not have to cope with servers that don't have (a) schemas or (b) pg_depend. That means we can get rid of assorted squishy code around that. There may be some nonobvious additional simplifications possible, but this patch already removes about 1500 lines of code. I did not remove the ability for pg_restore to read custom-format archives generated by these old versions (and light testing says that that does still work). If you have an old server, you probably also have a pg_dump that will work with it; but you have an old custom-format backup file, that might be all you have. It'd be possible at this point to remove fmtQualifiedId()'s version argument, but I refrained since that would affect code outside pg_dump. Discussion: <2661.1475849167@sss.pgh.pa.us>
1 parent bb55dd6 commit 64f3524
Copy full SHA for 64f3524

File tree

7 files changed

+250
-1777
lines changed
Filter options

7 files changed

+250
-1777
lines changed

‎doc/src/sgml/ref/pg_dump.sgml

Copy file name to clipboardExpand all lines: doc/src/sgml/ref/pg_dump.sgml
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,9 @@ PostgreSQL documentation
758758
the dump. Instead fail if unable to lock a table within the specified
759759
<replaceable class="parameter">timeout</>. The timeout may be
760760
specified in any of the formats accepted by <command>SET
761-
statement_timeout</>. (Allowed values vary depending on the server
761+
statement_timeout</>. (Allowed formats vary depending on the server
762762
version you are dumping from, but an integer number of milliseconds
763-
is accepted by all versions since 7.3. This option is ignored when
764-
dumping from a pre-7.3 server.)
763+
is accepted by all versions.)
765764
</para>
766765
</listitem>
767766
</varlistentry>
@@ -1172,7 +1171,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
11721171
<productname>PostgreSQL</> server versions newer than
11731172
<application>pg_dump</>'s version. <application>pg_dump</> can also
11741173
dump from <productname>PostgreSQL</> servers older than its own version.
1175-
(Currently, servers back to version 7.0 are supported.)
1174+
(Currently, servers back to version 8.0 are supported.)
11761175
However, <application>pg_dump</> cannot dump from
11771176
<productname>PostgreSQL</> servers newer than its own major version;
11781177
it will refuse to even try, rather than risk making an invalid dump.

‎src/bin/pg_dump/dumputils.c

Copy file name to clipboardExpand all lines: src/bin/pg_dump/dumputils.c
+21-29Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "fe_utils/string_utils.h"
1919

2020

21-
#define supports_grant_options(version) ((version) >= 70400)
22-
2321
static bool parseAclItem(const char *item, const char *type,
2422
const char *name, const char *subname, int remoteVersion,
2523
PQExpBuffer grantee, PQExpBuffer grantor,
@@ -246,11 +244,9 @@ buildACLCommands(const char *name, const char *subname,
246244

247245
/*
248246
* For the owner, the default privilege level is ALL WITH
249-
* GRANT OPTION (only ALL prior to 7.4).
247+
* GRANT OPTION.
250248
*/
251-
if (supports_grant_options(remoteVersion)
252-
? strcmp(privswgo->data, "ALL") != 0
253-
: strcmp(privs->data, "ALL") != 0)
249+
if (strcmp(privswgo->data, "ALL") != 0)
254250
{
255251
appendPQExpBuffer(firstsql, "%sREVOKE ALL", prefix);
256252
if (subname)
@@ -403,16 +399,19 @@ buildDefaultACLCommands(const char *type, const char *nspname,
403399
* username=privilegecodes/grantor
404400
* or
405401
* group groupname=privilegecodes/grantor
406-
* (the /grantor part will not be present if pre-7.4 database).
402+
* (the "group" case occurs only with servers before 8.1).
403+
*
404+
* Returns true on success, false on parse error. On success, the components
405+
* of the string are returned in the PQExpBuffer parameters.
407406
*
408407
* The returned grantee string will be the dequoted username or groupname
409-
* (preceded with "group " in the latter case). The returned grantor is
410-
* the dequoted grantor name or empty. Privilege characters are decoded
411-
* and split between privileges with grant option (privswgo) and without
412-
* (privs).
408+
* (preceded with "group " in the latter case). Note that a grant to PUBLIC
409+
* is represented by an empty grantee string. The returned grantor is the
410+
* dequoted grantor name. Privilege characters are decoded and split between
411+
* privileges with grant option (privswgo) and without (privs).
413412
*
414-
* Note: for cross-version compatibility, it's important to use ALL when
415-
* appropriate.
413+
* Note: for cross-version compatibility, it's important to use ALL to
414+
* represent the privilege sets whenever appropriate.
416415
*/
417416
static bool
418417
parseAclItem(const char *item, const char *type,
@@ -439,7 +438,7 @@ parseAclItem(const char *item, const char *type,
439438
return false;
440439
}
441440

442-
/* grantor may be listed after / */
441+
/* grantor should appear after / */
443442
slpos = strchr(eqpos + 1, '/');
444443
if (slpos)
445444
{
@@ -452,7 +451,10 @@ parseAclItem(const char *item, const char *type,
452451
}
453452
}
454453
else
455-
resetPQExpBuffer(grantor);
454+
{
455+
free(buf);
456+
return false;
457+
}
456458

457459
/* privilege codes */
458460
#define CONVERT_PRIV(code, keywd) \
@@ -490,29 +492,19 @@ do { \
490492
{
491493
/* table only */
492494
CONVERT_PRIV('a', "INSERT");
493-
if (remoteVersion >= 70200)
494-
CONVERT_PRIV('x', "REFERENCES");
495+
CONVERT_PRIV('x', "REFERENCES");
495496
/* rest are not applicable to columns */
496497
if (subname == NULL)
497498
{
498-
if (remoteVersion >= 70200)
499-
{
500-
CONVERT_PRIV('d', "DELETE");
501-
CONVERT_PRIV('t', "TRIGGER");
502-
}
499+
CONVERT_PRIV('d', "DELETE");
500+
CONVERT_PRIV('t', "TRIGGER");
503501
if (remoteVersion >= 80400)
504502
CONVERT_PRIV('D', "TRUNCATE");
505503
}
506504
}
507505

508506
/* UPDATE */
509-
if (remoteVersion >= 70200 ||
510-
strcmp(type, "SEQUENCE") == 0 ||
511-
strcmp(type, "SEQUENCES") == 0)
512-
CONVERT_PRIV('w', "UPDATE");
513-
else
514-
/* 7.0 and 7.1 have a simpler worldview */
515-
CONVERT_PRIV('w', "UPDATE,DELETE");
507+
CONVERT_PRIV('w', "UPDATE");
516508
}
517509
else if (strcmp(type, "FUNCTION") == 0 ||
518510
strcmp(type, "FUNCTIONS") == 0)

‎src/bin/pg_dump/pg_backup_archiver.c

Copy file name to clipboardExpand all lines: src/bin/pg_dump/pg_backup_archiver.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ RestoreArchive(Archive *AHX)
388388
* target.
389389
*/
390390
AHX->minRemoteVersion = 0;
391-
AHX->maxRemoteVersion = 999999;
391+
AHX->maxRemoteVersion = 9999999;
392392

393393
ConnectDatabase(AHX, ropt->dbname,
394394
ropt->pghost, ropt->pgport, ropt->username,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.