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

Commit35ce24c

Browse files
committed
pg_dump: Remove "blob" terminology
For historical reasons, pg_dump refers to large objects as "BLOBs".This term is not used anywhere else in PostgreSQL, and it also meanssomething different in the SQL standard and other SQL systems.This patch renames internal functions, code comments, documentation,etc. to use the "large object" or "LO" terminology instead. There isno functionality change, so the archive format still uses the name"BLOB" for the archive entry. Additional long command-line optionsare added with the new naming.Reviewed-by: Daniel Gustafsson <daniel@yesql.se>Discussion:https://www.postgresql.org/message-id/flat/868a381f-4650-9460-1726-1ffd39a270b4%40enterprisedb.com
1 parent8a476fd commit35ce24c

File tree

14 files changed

+367
-361
lines changed

14 files changed

+367
-361
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,16 @@ PostgreSQL documentation
132132

133133
<varlistentry>
134134
<term><option>-b</option></term>
135-
<term><option>--blobs</option></term>
135+
<term><option>--large-objects</option></term>
136+
<term><option>--blobs</option> (deprecated)</term>
136137
<listitem>
137138
<para>
138139
Include large objects in the dump. This is the default behavior
139140
except when <option>--schema</option>, <option>--table</option>, or
140141
<option>--schema-only</option> is specified. The <option>-b</option>
141142
switch is therefore only useful to add large objects to dumps
142143
where a specific schema or table has been requested. Note that
143-
blobs are considered data and therefore will be included when
144+
large objects are considered data and therefore will be included when
144145
<option>--data-only</option> is used, but not
145146
when <option>--schema-only</option> is.
146147
</para>
@@ -149,7 +150,8 @@ PostgreSQL documentation
149150

150151
<varlistentry>
151152
<term><option>-B</option></term>
152-
<term><option>--no-blobs</option></term>
153+
<term><option>--no-large-objects</option></term>
154+
<term><option>--no-blobs</option> (deprecated)</term>
153155
<listitem>
154156
<para>
155157
Exclude large objects in the dump.
@@ -323,7 +325,7 @@ PostgreSQL documentation
323325
<para>
324326
Output a directory-format archive suitable for input into
325327
<application>pg_restore</application>. This will create a directory
326-
with one file for each table andblob being dumped, plus a
328+
with one file for each table andlarge object being dumped, plus a
327329
so-called Table of Contents file describing the dumped objects in a
328330
machine-readable format that <application>pg_restore</application>
329331
can read. A directory format archive can be manipulated with
@@ -434,9 +436,9 @@ PostgreSQL documentation
434436

435437
<note>
436438
<para>
437-
Non-schema objects such asblobs are not dumped when <option>-n</option> is
438-
specified. You can addblobs back to the dump with the
439-
<option>--blobs</option> switch.
439+
Non-schema objects such aslarge objects are not dumped when <option>-n</option> is
440+
specified. You can addlarge objects back to the dump with the
441+
<option>--large-objects</option> switch.
440442
</para>
441443
</note>
442444

‎src/bin/pg_dump/pg_backup.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ typedef enum _archiveMode
5353

5454
typedefenum_teSection
5555
{
56-
SECTION_NONE=1,/*COMMENTs, ACLs, etc; can be anywhere */
56+
SECTION_NONE=1,/*comments, ACLs, etc; can be anywhere */
5757
SECTION_PRE_DATA,/* stuff to be processed before data */
58-
SECTION_DATA,/*TABLE DATA, BLOBS, BLOB COMMENTS */
58+
SECTION_DATA,/*table data, large objects, LO comments */
5959
SECTION_POST_DATA/* stuff to be processed after data */
6060
}teSection;
6161

@@ -193,8 +193,8 @@ typedef struct _dumpOptions
193193

194194
intoutputClean;
195195
intoutputCreateDB;
196-
booloutputBlobs;
197-
booldontOutputBlobs;
196+
booloutputLOs;
197+
booldontOutputLOs;
198198
intoutputNoOwner;
199199
char*outputSuperuser;
200200

@@ -289,8 +289,8 @@ extern PGconn *GetConnection(Archive *AHX);
289289
/* Called to write *data* to the archive */
290290
externvoidWriteData(Archive*AHX,constvoid*data,size_tdLen);
291291

292-
externintStartBlob(Archive*AHX,Oidoid);
293-
externintEndBlob(Archive*AHX,Oidoid);
292+
externintStartLO(Archive*AHX,Oidoid);
293+
externintEndLO(Archive*AHX,Oidoid);
294294

295295
externvoidCloseArchive(Archive*AHX);
296296

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ RestoreArchive(Archive *AHX)
554554
*/
555555
if (strncmp(te->desc,"BLOB",4)==0)
556556
{
557-
DropBlobIfExists(AH,te->catalogId.oid);
557+
DropLOIfExists(AH,te->catalogId.oid);
558558
}
559559
else
560560
{
@@ -1224,44 +1224,44 @@ PrintTOCSummary(Archive *AHX)
12241224
}
12251225

12261226
/***********
1227-
*BLOB Archival
1227+
*Large Object Archival
12281228
***********/
12291229

1230-
/* Called by a dumper to signal start of aBLOB */
1230+
/* Called by a dumper to signal start of aLO */
12311231
int
1232-
StartBlob(Archive*AHX,Oidoid)
1232+
StartLO(Archive*AHX,Oidoid)
12331233
{
12341234
ArchiveHandle*AH= (ArchiveHandle*)AHX;
12351235

1236-
if (!AH->StartBlobPtr)
1236+
if (!AH->StartLOPtr)
12371237
pg_fatal("large-object output not supported in chosen format");
12381238

1239-
AH->StartBlobPtr(AH,AH->currToc,oid);
1239+
AH->StartLOPtr(AH,AH->currToc,oid);
12401240

12411241
return1;
12421242
}
12431243

1244-
/* Called by a dumper to signal end of aBLOB */
1244+
/* Called by a dumper to signal end of aLO */
12451245
int
1246-
EndBlob(Archive*AHX,Oidoid)
1246+
EndLO(Archive*AHX,Oidoid)
12471247
{
12481248
ArchiveHandle*AH= (ArchiveHandle*)AHX;
12491249

1250-
if (AH->EndBlobPtr)
1251-
AH->EndBlobPtr(AH,AH->currToc,oid);
1250+
if (AH->EndLOPtr)
1251+
AH->EndLOPtr(AH,AH->currToc,oid);
12521252

12531253
return1;
12541254
}
12551255

12561256
/**********
1257-
*BLOB Restoration
1257+
*Large Object Restoration
12581258
**********/
12591259

12601260
/*
1261-
* Called by a format handler before anyblobs are restored
1261+
* Called by a format handler before anyLOs are restored
12621262
*/
12631263
void
1264-
StartRestoreBlobs(ArchiveHandle*AH)
1264+
StartRestoreLOs(ArchiveHandle*AH)
12651265
{
12661266
RestoreOptions*ropt=AH->public.ropt;
12671267

@@ -1273,14 +1273,14 @@ StartRestoreBlobs(ArchiveHandle *AH)
12731273
ahprintf(AH,"BEGIN;\n\n");
12741274
}
12751275

1276-
AH->blobCount=0;
1276+
AH->loCount=0;
12771277
}
12781278

12791279
/*
1280-
* Called by a format handler after allblobs are restored
1280+
* Called by a format handler after allLOs are restored
12811281
*/
12821282
void
1283-
EndRestoreBlobs(ArchiveHandle*AH)
1283+
EndRestoreLOs(ArchiveHandle*AH)
12841284
{
12851285
RestoreOptions*ropt=AH->public.ropt;
12861286

@@ -1294,34 +1294,34 @@ EndRestoreBlobs(ArchiveHandle *AH)
12941294

12951295
pg_log_info(ngettext("restored %d large object",
12961296
"restored %d large objects",
1297-
AH->blobCount),
1298-
AH->blobCount);
1297+
AH->loCount),
1298+
AH->loCount);
12991299
}
13001300

13011301

13021302
/*
1303-
* Called by a format handler to initiate restoration of ablob
1303+
* Called by a format handler to initiate restoration of aLO
13041304
*/
13051305
void
1306-
StartRestoreBlob(ArchiveHandle*AH,Oidoid,booldrop)
1306+
StartRestoreLO(ArchiveHandle*AH,Oidoid,booldrop)
13071307
{
1308-
boolold_blob_style= (AH->version<K_VERS_1_12);
1308+
boolold_lo_style= (AH->version<K_VERS_1_12);
13091309
OidloOid;
13101310

1311-
AH->blobCount++;
1311+
AH->loCount++;
13121312

13131313
/* Initialize the LO Buffer */
13141314
AH->lo_buf_used=0;
13151315

13161316
pg_log_info("restoring large object with OID %u",oid);
13171317

13181318
/* With an old archive we must do drop and create logic here */
1319-
if (old_blob_style&&drop)
1320-
DropBlobIfExists(AH,oid);
1319+
if (old_lo_style&&drop)
1320+
DropLOIfExists(AH,oid);
13211321

13221322
if (AH->connection)
13231323
{
1324-
if (old_blob_style)
1324+
if (old_lo_style)
13251325
{
13261326
loOid=lo_create(AH->connection,oid);
13271327
if (loOid==0||loOid!=oid)
@@ -1335,27 +1335,27 @@ StartRestoreBlob(ArchiveHandle *AH, Oid oid, bool drop)
13351335
}
13361336
else
13371337
{
1338-
if (old_blob_style)
1338+
if (old_lo_style)
13391339
ahprintf(AH,"SELECT pg_catalog.lo_open(pg_catalog.lo_create('%u'), %d);\n",
13401340
oid,INV_WRITE);
13411341
else
13421342
ahprintf(AH,"SELECT pg_catalog.lo_open('%u', %d);\n",
13431343
oid,INV_WRITE);
13441344
}
13451345

1346-
AH->writingBlob=1;
1346+
AH->writingLO=true;
13471347
}
13481348

13491349
void
1350-
EndRestoreBlob(ArchiveHandle*AH,Oidoid)
1350+
EndRestoreLO(ArchiveHandle*AH,Oidoid)
13511351
{
13521352
if (AH->lo_buf_used>0)
13531353
{
13541354
/* Write remaining bytes from the LO buffer */
13551355
dump_lo_buf(AH);
13561356
}
13571357

1358-
AH->writingBlob=0;
1358+
AH->writingLO=false;
13591359

13601360
if (AH->connection)
13611361
{
@@ -1645,7 +1645,7 @@ RestoringToDB(ArchiveHandle *AH)
16451645
}
16461646

16471647
/*
1648-
* Dump the current contents of the LO data buffer while writing aBLOB
1648+
* Dump the current contents of the LO data buffer while writing aLO
16491649
*/
16501650
staticvoid
16511651
dump_lo_buf(ArchiveHandle*AH)
@@ -1673,10 +1673,10 @@ dump_lo_buf(ArchiveHandle *AH)
16731673
AH->lo_buf_used,
16741674
AH);
16751675

1676-
/* Hack: turn offwritingBlob so ahwrite doesn't recurse to here */
1677-
AH->writingBlob=0;
1676+
/* Hack: turn offwritingLO so ahwrite doesn't recurse to here */
1677+
AH->writingLO=false;
16781678
ahprintf(AH,"SELECT pg_catalog.lowrite(0, %s);\n",buf->data);
1679-
AH->writingBlob=1;
1679+
AH->writingLO=true;
16801680

16811681
destroyPQExpBuffer(buf);
16821682
}
@@ -1695,7 +1695,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
16951695
{
16961696
intbytes_written=0;
16971697

1698-
if (AH->writingBlob)
1698+
if (AH->writingLO)
16991699
{
17001700
size_tremaining=size*nmemb;
17011701

@@ -2324,7 +2324,7 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
23242324
}
23252325

23262326
/*
2327-
* Write out all data (tables &blobs)
2327+
* Write out all data (tables &LOs)
23282328
*/
23292329
void
23302330
WriteDataChunks(ArchiveHandle*AH,ParallelState*pstate)
@@ -2418,8 +2418,8 @@ WriteDataChunksForTocEntry(ArchiveHandle *AH, TocEntry *te)
24182418

24192419
if (strcmp(te->desc,"BLOBS")==0)
24202420
{
2421-
startPtr=AH->StartBlobsPtr;
2422-
endPtr=AH->EndBlobsPtr;
2421+
startPtr=AH->StartLOsPtr;
2422+
endPtr=AH->EndLOsPtr;
24232423
}
24242424
else
24252425
{
@@ -2965,7 +2965,7 @@ _tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH)
29652965
if (!te->hadDumper)
29662966
{
29672967
/*
2968-
* Special Case: If 'SEQUENCE SET' or anything to do withBLOBs, then
2968+
* Special Case: If 'SEQUENCE SET' or anything to do withLOs, then
29692969
* it is considered a data entry. We don't need to check for the
29702970
* BLOBS entry or old-style BLOB COMMENTS, because they will have
29712971
* hadDumper = true ... but we do need to check new-style BLOB ACLs,
@@ -3451,7 +3451,7 @@ _getObjectDescription(PQExpBuffer buf, const TocEntry *te)
34513451
appendPQExpBuffer(buf,"%s.",fmtId(te->namespace));
34523452
appendPQExpBufferStr(buf,fmtId(te->tag));
34533453
}
3454-
/*BLOBs just have a name, but it's numeric so must not use fmtId */
3454+
/*LOs just have a name, but it's numeric so must not use fmtId */
34553455
elseif (strcmp(type,"BLOB")==0)
34563456
{
34573457
appendPQExpBuffer(buf,"LARGE OBJECT %s",te->tag);

‎src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ typedef z_stream *z_streamp;
7070
/* Historical version numbers (checked in code) */
7171
#defineK_VERS_1_0MAKE_ARCHIVE_VERSION(1, 0, 0)
7272
#defineK_VERS_1_2MAKE_ARCHIVE_VERSION(1, 2, 0)/* Allow No ZLIB */
73-
#defineK_VERS_1_3MAKE_ARCHIVE_VERSION(1, 3, 0)/*BLOBs */
73+
#defineK_VERS_1_3MAKE_ARCHIVE_VERSION(1, 3, 0)/*BLOBS */
7474
#defineK_VERS_1_4MAKE_ARCHIVE_VERSION(1, 4, 0)/* Date & name in header */
7575
#defineK_VERS_1_5MAKE_ARCHIVE_VERSION(1, 5, 0)/* Handle dependencies */
7676
#defineK_VERS_1_6MAKE_ARCHIVE_VERSION(1, 6, 0)/* Schema field in TOCs */
@@ -145,10 +145,10 @@ typedef void (*StartDataPtrType) (ArchiveHandle *AH, TocEntry *te);
145145
typedefvoid (*WriteDataPtrType) (ArchiveHandle*AH,constvoid*data,size_tdLen);
146146
typedefvoid (*EndDataPtrType) (ArchiveHandle*AH,TocEntry*te);
147147

148-
typedefvoid (*StartBlobsPtrType) (ArchiveHandle*AH,TocEntry*te);
149-
typedefvoid (*StartBlobPtrType) (ArchiveHandle*AH,TocEntry*te,Oidoid);
150-
typedefvoid (*EndBlobPtrType) (ArchiveHandle*AH,TocEntry*te,Oidoid);
151-
typedefvoid (*EndBlobsPtrType) (ArchiveHandle*AH,TocEntry*te);
148+
typedefvoid (*StartLOsPtrType) (ArchiveHandle*AH,TocEntry*te);
149+
typedefvoid (*StartLOPtrType) (ArchiveHandle*AH,TocEntry*te,Oidoid);
150+
typedefvoid (*EndLOPtrType) (ArchiveHandle*AH,TocEntry*te,Oidoid);
151+
typedefvoid (*EndLOsPtrType) (ArchiveHandle*AH,TocEntry*te);
152152

153153
typedefint (*WriteBytePtrType) (ArchiveHandle*AH,constinti);
154154
typedefint (*ReadBytePtrType) (ArchiveHandle*AH);
@@ -285,10 +285,10 @@ struct _archiveHandle
285285
PrintExtraTocPtrTypePrintExtraTocPtr;/* Extra TOC info for format */
286286
PrintTocDataPtrTypePrintTocDataPtr;
287287

288-
StartBlobsPtrTypeStartBlobsPtr;
289-
EndBlobsPtrTypeEndBlobsPtr;
290-
StartBlobPtrTypeStartBlobPtr;
291-
EndBlobPtrTypeEndBlobPtr;
288+
StartLOsPtrTypeStartLOsPtr;
289+
EndLOsPtrTypeEndLOsPtr;
290+
StartLOPtrTypeStartLOPtr;
291+
EndLOPtrTypeEndLOPtr;
292292

293293
SetupWorkerPtrTypeSetupWorkerPtr;
294294
WorkerJobDumpPtrTypeWorkerJobDumpPtr;
@@ -313,9 +313,9 @@ struct _archiveHandle
313313
ArchiverOutputoutputKind;/* Flag for what we're currently writing */
314314
boolpgCopyIn;/* Currently in libpq 'COPY IN' mode. */
315315

316-
intloFd;/* BLOB fd */
317-
intwritingBlob;/* Flag */
318-
intblobCount;/* # ofblobs restored */
316+
intloFd;
317+
boolwritingLO;
318+
intloCount;/* # ofLOs restored */
319319

320320
char*fSpec;/* Archive File Spec */
321321
FILE*FH;/* General purpose file handle */
@@ -456,10 +456,10 @@ extern size_t WriteStr(ArchiveHandle *AH, const char *c);
456456
intReadOffset(ArchiveHandle*,pgoff_t*);
457457
size_tWriteOffset(ArchiveHandle*,pgoff_t,int);
458458

459-
externvoidStartRestoreBlobs(ArchiveHandle*AH);
460-
externvoidStartRestoreBlob(ArchiveHandle*AH,Oidoid,booldrop);
461-
externvoidEndRestoreBlob(ArchiveHandle*AH,Oidoid);
462-
externvoidEndRestoreBlobs(ArchiveHandle*AH);
459+
externvoidStartRestoreLOs(ArchiveHandle*AH);
460+
externvoidStartRestoreLO(ArchiveHandle*AH,Oidoid,booldrop);
461+
externvoidEndRestoreLO(ArchiveHandle*AH,Oidoid);
462+
externvoidEndRestoreLOs(ArchiveHandle*AH);
463463

464464
externvoidInitArchiveFmt_Custom(ArchiveHandle*AH);
465465
externvoidInitArchiveFmt_Null(ArchiveHandle*AH);
@@ -469,7 +469,7 @@ extern void InitArchiveFmt_Tar(ArchiveHandle *AH);
469469
externboolisValidTarHeader(char*header);
470470

471471
externvoidReconnectToServer(ArchiveHandle*AH,constchar*dbname);
472-
externvoidDropBlobIfExists(ArchiveHandle*AH,Oidoid);
472+
externvoidDropLOIfExists(ArchiveHandle*AH,Oidoid);
473473

474474
voidahwrite(constvoid*ptr,size_tsize,size_tnmemb,ArchiveHandle*AH);
475475
intahprintf(ArchiveHandle*AH,constchar*fmt,...)pg_attribute_printf(2,3);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp