Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commit54bb91c

Browse files
committed
Further tweaking of pg_dump's handling of default_toast_compression.
As committed inbbe0a81, pg_dump from a pre-v14 server effectivelyacts as though you'd said --no-toast-compression. I think the rightthing is for it to act as though default_toast_compression is set to"pglz", instead, so that the tables' toast compression behavior ispreserved. You can always get the other behavior, if you want that,by giving the switch.Discussion:https://postgr.es/m/1112852.1616609702@sss.pgh.pa.us
1 parented934d4 commit54bb91c

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,18 +3333,28 @@ dumpSearchPath(Archive *AH)
33333333
static void
33343334
dumpToastCompression(Archive *AH)
33353335
{
3336-
constchar *toast_compression;
3336+
char *toast_compression;
33373337
PQExpBuffer qry;
3338-
PGresult *res;
33393338

3340-
if (AH->remoteVersion < 140000 || AH->dopt->no_toast_compression)
3339+
if (AH->dopt->no_toast_compression)
33413340
{
3342-
/*server doesn'tsupport compression, or we don't care */
3341+
/*we don'tintend to dump the info, so no need to fetch it either */
33433342
return;
33443343
}
33453344

3346-
res = ExecuteSqlQueryForSingleRow(AH, "SHOW default_toast_compression");
3347-
toast_compression = PQgetvalue(res, 0, 0);
3345+
if (AH->remoteVersion < 140000)
3346+
{
3347+
/* pre-v14, the only method was pglz */
3348+
toast_compression = pg_strdup("pglz");
3349+
}
3350+
else
3351+
{
3352+
PGresult *res;
3353+
3354+
res = ExecuteSqlQueryForSingleRow(AH, "SHOW default_toast_compression");
3355+
toast_compression = pg_strdup(PQgetvalue(res, 0, 0));
3356+
PQclear(res);
3357+
}
33483358

33493359
qry = createPQExpBuffer();
33503360
appendPQExpBufferStr(qry, "SET default_toast_compression = ");
@@ -3363,9 +3373,8 @@ dumpToastCompression(Archive *AH)
33633373
* Also save it in AH->default_toast_compression, in case we're doing
33643374
* plain text dump.
33653375
*/
3366-
AH->default_toast_compression =pg_strdup(toast_compression);
3376+
AH->default_toast_compression = toast_compression;
33673377

3368-
PQclear(res);
33693378
destroyPQExpBuffer(qry);
33703379
}
33713380

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp