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

Commit2b32153

Browse files
committed
Fix up grammar and translatability of recent checkSharedDependencies
patch; also make the code logic a bit more self-consistent.
1 parentfd53a67 commit2b32153

File tree

1 file changed

+40
-44
lines changed

1 file changed

+40
-44
lines changed

‎src/backend/catalog/pg_shdepend.c

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.19 2007/05/1416:50:36 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.20 2007/05/1420:07:01 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -458,7 +458,7 @@ typedef struct
458458
* descriptions that depend on the shared object, or NULL if none is found.
459459
* The size of the returned string is limited to about MAX_REPORTED_DEPS lines;
460460
* if there are more objects than that, the output is returned truncated at
461-
* that pointand the full message is logged to the postmaster log.
461+
* that pointwhile the full message is logged to the postmaster log.
462462
*
463463
* We can find three different kinds of dependencies: dependencies on objects
464464
* of the current database; dependencies on shared objects; and dependencies
@@ -475,8 +475,8 @@ checkSharedDependencies(Oid classId, Oid objectId)
475475
ScanKeyDatakey[2];
476476
SysScanDescscan;
477477
HeapTupletup;
478-
intnumNotReportedDeps=0;
479478
intnumReportedDeps=0;
479+
intnumNotReportedDeps=0;
480480
intnumNotReportedDbs=0;
481481
List*remDeps=NIL;
482482
ListCell*cell;
@@ -485,11 +485,11 @@ checkSharedDependencies(Oid classId, Oid objectId)
485485
StringInfoDataalldescs;
486486

487487
/*
488-
* Wetry tolimit the number of dependencies reported to the client to
489-
*something sane, both for the user's sake and to avoid blowing out
490-
*memory. The server log always gets a full report, which is collected
491-
* in a separate StringInfo if and only if we detect that the original
492-
* report is going to be truncated.
488+
* We limit the number of dependencies reported to the client to
489+
*MAX_REPORTED_DEPS, since client software may not deal well with
490+
*enormous error strings. The server log always gets a full report,
491+
*which is collectedin a separate StringInfo if and only if we detect
492+
*that the clientreport is going to be truncated.
493493
*/
494494
#defineMAX_REPORTED_DEPS 100
495495

@@ -539,9 +539,12 @@ checkSharedDependencies(Oid classId, Oid objectId)
539539
*/
540540
if (sdepForm->dbid==MyDatabaseId)
541541
{
542-
if (++numReportedDeps <=MAX_REPORTED_DEPS)
542+
if (numReportedDeps<MAX_REPORTED_DEPS)
543+
{
544+
numReportedDeps++;
543545
storeObjectDescription(&descs,LOCAL_OBJECT,&object,
544546
sdepForm->deptype,0);
547+
}
545548
else
546549
{
547550
numNotReportedDeps++;
@@ -555,9 +558,12 @@ checkSharedDependencies(Oid classId, Oid objectId)
555558
}
556559
elseif (sdepForm->dbid==InvalidOid)
557560
{
558-
if (++numReportedDeps <=MAX_REPORTED_DEPS)
561+
if (numReportedDeps<MAX_REPORTED_DEPS)
562+
{
563+
numReportedDeps++;
559564
storeObjectDescription(&descs,SHARED_OBJECT,&object,
560565
sdepForm->deptype,0);
566+
}
561567
else
562568
{
563569
numNotReportedDeps++;
@@ -618,35 +624,22 @@ checkSharedDependencies(Oid classId, Oid objectId)
618624
object.objectId=dep->dbOid;
619625
object.objectSubId=0;
620626

621-
if (alldescs.len!=0)
627+
if (numReportedDeps<MAX_REPORTED_DEPS)
622628
{
623-
numNotReportedDbs++;
624-
storeObjectDescription(&alldescs,REMOTE_OBJECT,&object,
629+
numReportedDeps++;
630+
storeObjectDescription(&descs,REMOTE_OBJECT,&object,
625631
SHARED_DEPENDENCY_INVALID,dep->count);
626632
}
627633
else
628634
{
629-
if (numReportedDeps <=MAX_REPORTED_DEPS)
630-
{
631-
numReportedDeps++;
632-
storeObjectDescription(&descs,REMOTE_OBJECT,&object,
633-
SHARED_DEPENDENCY_INVALID,dep->count);
634-
}
635-
else
636-
{
637-
/* initialize the server-only log line */
638-
numNotReportedDbs++;
635+
numNotReportedDbs++;
636+
/* initialize the server-only log line */
637+
if (alldescs.len==0)
639638
appendBinaryStringInfo(&alldescs,descs.data,descs.len);
640-
storeObjectDescription(&alldescs,REMOTE_OBJECT,&object,
641-
SHARED_DEPENDENCY_INVALID,dep->count);
642-
}
643-
}
644-
}
645639

646-
if (numNotReportedDbs>0)
647-
{
648-
appendStringInfo(&descs,"\nand objects in other %d databases",
649-
numNotReportedDbs);
640+
storeObjectDescription(&alldescs,REMOTE_OBJECT,&object,
641+
SHARED_DEPENDENCY_INVALID,dep->count);
642+
}
650643
}
651644

652645
list_free_deep(remDeps);
@@ -658,21 +651,28 @@ checkSharedDependencies(Oid classId, Oid objectId)
658651
returnNULL;
659652
}
660653

661-
if (numNotReportedDbs+numNotReportedDeps>0)
654+
if (numNotReportedDeps>0)
655+
appendStringInfo(&descs,_("\nand %d other objects "
656+
"(see server log for list)"),
657+
numNotReportedDeps);
658+
if (numNotReportedDbs>0)
659+
appendStringInfo(&descs,_("\nand objects in %d other databases "
660+
"(see server log for list)"),
661+
numNotReportedDbs);
662+
663+
if (numNotReportedDeps>0||numNotReportedDbs>0)
662664
{
663665
ObjectAddressobj;
664666

665667
obj.classId=classId;
666668
obj.objectId=objectId;
667669
obj.objectSubId=0;
668670
ereport(LOG,
669-
(errmsg("objects dependent on %s",getObjectDescription(&obj)),
671+
(errmsg("there are objects dependent on %s",
672+
getObjectDescription(&obj)),
670673
errdetail(alldescs.data)));
671-
672-
if (numNotReportedDeps>0)
673-
appendStringInfo(&descs,"\nand other %d objects",
674-
numNotReportedDeps);
675674
}
675+
676676
pfree(alldescs.data);
677677

678678
returndescs.data;
@@ -1030,12 +1030,8 @@ storeObjectDescription(StringInfo descs, objectType type,
10301030
break;
10311031

10321032
caseREMOTE_OBJECT:
1033-
if (count==1)
1034-
/* translator: %s will always be "database %s" */
1035-
appendStringInfo(descs,_("one object in %s"),objdesc);
1036-
else
1037-
/* translator: %s will always be "database %s" */
1038-
appendStringInfo(descs,_("%d objects in %s"),count,objdesc);
1033+
/* translator: %s will always be "database %s" */
1034+
appendStringInfo(descs,_("%d objects in %s"),count,objdesc);
10391035
break;
10401036

10411037
default:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp