Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
2b321533
Commit
2b321533
authored
May 14, 2007
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up grammar and translatability of recent checkSharedDependencies
patch; also make the code logic a bit more self-consistent.
parent
fd53a67d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
44 deletions
+40
-44
src/backend/catalog/pg_shdepend.c
src/backend/catalog/pg_shdepend.c
+40
-44
No files found.
src/backend/catalog/pg_shdepend.c
View file @
2b321533
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.
19 2007/05/14 16:50:36 alvherre
Exp $
* $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.
20 2007/05/14 20:07:01 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -458,7 +458,7 @@ typedef struct
...
@@ -458,7 +458,7 @@ typedef struct
* descriptions that depend on the shared object, or NULL if none is found.
* descriptions that depend on the shared object, or NULL if none is found.
* The size of the returned string is limited to about MAX_REPORTED_DEPS lines;
* The size of the returned string is limited to about MAX_REPORTED_DEPS lines;
* if there are more objects than that, the output is returned truncated at
* if there are more objects than that, the output is returned truncated at
* that point
and
the full message is logged to the postmaster log.
* that point
while
the full message is logged to the postmaster log.
*
*
* We can find three different kinds of dependencies: dependencies on objects
* We can find three different kinds of dependencies: dependencies on objects
* of the current database; dependencies on shared objects; and dependencies
* of the current database; dependencies on shared objects; and dependencies
...
@@ -475,8 +475,8 @@ checkSharedDependencies(Oid classId, Oid objectId)
...
@@ -475,8 +475,8 @@ checkSharedDependencies(Oid classId, Oid objectId)
ScanKeyData
key
[
2
];
ScanKeyData
key
[
2
];
SysScanDesc
scan
;
SysScanDesc
scan
;
HeapTuple
tup
;
HeapTuple
tup
;
int
numNotReportedDeps
=
0
;
int
numReportedDeps
=
0
;
int
numReportedDeps
=
0
;
int
numNotReportedDeps
=
0
;
int
numNotReportedDbs
=
0
;
int
numNotReportedDbs
=
0
;
List
*
remDeps
=
NIL
;
List
*
remDeps
=
NIL
;
ListCell
*
cell
;
ListCell
*
cell
;
...
@@ -485,11 +485,11 @@ checkSharedDependencies(Oid classId, Oid objectId)
...
@@ -485,11 +485,11 @@ checkSharedDependencies(Oid classId, Oid objectId)
StringInfoData
alldescs
;
StringInfoData
alldescs
;
/*
/*
* We
try to
limit the number of dependencies reported to the client to
* We limit the number of dependencies reported to the client to
*
something sane, both for the user's sake and to avoid blowing out
*
MAX_REPORTED_DEPS, since client software may not deal well with
*
memory. The server log always gets a full report, which is collected
*
enormous error strings. The server log always gets a full report,
*
in a separate StringInfo if and only if we detect that the original
*
which is collected in a separate StringInfo if and only if we detect
* report is going to be truncated.
*
that the client
report is going to be truncated.
*/
*/
#define MAX_REPORTED_DEPS 100
#define MAX_REPORTED_DEPS 100
...
@@ -539,9 +539,12 @@ checkSharedDependencies(Oid classId, Oid objectId)
...
@@ -539,9 +539,12 @@ checkSharedDependencies(Oid classId, Oid objectId)
*/
*/
if
(
sdepForm
->
dbid
==
MyDatabaseId
)
if
(
sdepForm
->
dbid
==
MyDatabaseId
)
{
{
if
(
++
numReportedDeps
<=
MAX_REPORTED_DEPS
)
if
(
numReportedDeps
<
MAX_REPORTED_DEPS
)
{
numReportedDeps
++
;
storeObjectDescription
(
&
descs
,
LOCAL_OBJECT
,
&
object
,
storeObjectDescription
(
&
descs
,
LOCAL_OBJECT
,
&
object
,
sdepForm
->
deptype
,
0
);
sdepForm
->
deptype
,
0
);
}
else
else
{
{
numNotReportedDeps
++
;
numNotReportedDeps
++
;
...
@@ -555,9 +558,12 @@ checkSharedDependencies(Oid classId, Oid objectId)
...
@@ -555,9 +558,12 @@ checkSharedDependencies(Oid classId, Oid objectId)
}
}
else
if
(
sdepForm
->
dbid
==
InvalidOid
)
else
if
(
sdepForm
->
dbid
==
InvalidOid
)
{
{
if
(
++
numReportedDeps
<=
MAX_REPORTED_DEPS
)
if
(
numReportedDeps
<
MAX_REPORTED_DEPS
)
{
numReportedDeps
++
;
storeObjectDescription
(
&
descs
,
SHARED_OBJECT
,
&
object
,
storeObjectDescription
(
&
descs
,
SHARED_OBJECT
,
&
object
,
sdepForm
->
deptype
,
0
);
sdepForm
->
deptype
,
0
);
}
else
else
{
{
numNotReportedDeps
++
;
numNotReportedDeps
++
;
...
@@ -618,15 +624,7 @@ checkSharedDependencies(Oid classId, Oid objectId)
...
@@ -618,15 +624,7 @@ checkSharedDependencies(Oid classId, Oid objectId)
object
.
objectId
=
dep
->
dbOid
;
object
.
objectId
=
dep
->
dbOid
;
object
.
objectSubId
=
0
;
object
.
objectSubId
=
0
;
if
(
alldescs
.
len
!=
0
)
if
(
numReportedDeps
<
MAX_REPORTED_DEPS
)
{
numNotReportedDbs
++
;
storeObjectDescription
(
&
alldescs
,
REMOTE_OBJECT
,
&
object
,
SHARED_DEPENDENCY_INVALID
,
dep
->
count
);
}
else
{
if
(
numReportedDeps
<=
MAX_REPORTED_DEPS
)
{
{
numReportedDeps
++
;
numReportedDeps
++
;
storeObjectDescription
(
&
descs
,
REMOTE_OBJECT
,
&
object
,
storeObjectDescription
(
&
descs
,
REMOTE_OBJECT
,
&
object
,
...
@@ -634,20 +632,15 @@ checkSharedDependencies(Oid classId, Oid objectId)
...
@@ -634,20 +632,15 @@ checkSharedDependencies(Oid classId, Oid objectId)
}
}
else
else
{
{
/* initialize the server-only log line */
numNotReportedDbs
++
;
numNotReportedDbs
++
;
/* initialize the server-only log line */
if
(
alldescs
.
len
==
0
)
appendBinaryStringInfo
(
&
alldescs
,
descs
.
data
,
descs
.
len
);
appendBinaryStringInfo
(
&
alldescs
,
descs
.
data
,
descs
.
len
);
storeObjectDescription
(
&
alldescs
,
REMOTE_OBJECT
,
&
object
,
storeObjectDescription
(
&
alldescs
,
REMOTE_OBJECT
,
&
object
,
SHARED_DEPENDENCY_INVALID
,
dep
->
count
);
SHARED_DEPENDENCY_INVALID
,
dep
->
count
);
}
}
}
}
}
if
(
numNotReportedDbs
>
0
)
{
appendStringInfo
(
&
descs
,
"
\n
and objects in other %d databases"
,
numNotReportedDbs
);
}
list_free_deep
(
remDeps
);
list_free_deep
(
remDeps
);
...
@@ -658,7 +651,16 @@ checkSharedDependencies(Oid classId, Oid objectId)
...
@@ -658,7 +651,16 @@ checkSharedDependencies(Oid classId, Oid objectId)
return
NULL
;
return
NULL
;
}
}
if
(
numNotReportedDbs
+
numNotReportedDeps
>
0
)
if
(
numNotReportedDeps
>
0
)
appendStringInfo
(
&
descs
,
_
(
"
\n
and %d other objects "
"(see server log for list)"
),
numNotReportedDeps
);
if
(
numNotReportedDbs
>
0
)
appendStringInfo
(
&
descs
,
_
(
"
\n
and objects in %d other databases "
"(see server log for list)"
),
numNotReportedDbs
);
if
(
numNotReportedDeps
>
0
||
numNotReportedDbs
>
0
)
{
{
ObjectAddress
obj
;
ObjectAddress
obj
;
...
@@ -666,13 +668,11 @@ checkSharedDependencies(Oid classId, Oid objectId)
...
@@ -666,13 +668,11 @@ checkSharedDependencies(Oid classId, Oid objectId)
obj
.
objectId
=
objectId
;
obj
.
objectId
=
objectId
;
obj
.
objectSubId
=
0
;
obj
.
objectSubId
=
0
;
ereport
(
LOG
,
ereport
(
LOG
,
(
errmsg
(
"objects dependent on %s"
,
getObjectDescription
(
&
obj
)),
(
errmsg
(
"there are objects dependent on %s"
,
getObjectDescription
(
&
obj
)),
errdetail
(
alldescs
.
data
)));
errdetail
(
alldescs
.
data
)));
if
(
numNotReportedDeps
>
0
)
appendStringInfo
(
&
descs
,
"
\n
and other %d objects"
,
numNotReportedDeps
);
}
}
pfree
(
alldescs
.
data
);
pfree
(
alldescs
.
data
);
return
descs
.
data
;
return
descs
.
data
;
...
@@ -1030,10 +1030,6 @@ storeObjectDescription(StringInfo descs, objectType type,
...
@@ -1030,10 +1030,6 @@ storeObjectDescription(StringInfo descs, objectType type,
break
;
break
;
case
REMOTE_OBJECT
:
case
REMOTE_OBJECT
:
if
(
count
==
1
)
/* translator: %s will always be "database %s" */
appendStringInfo
(
descs
,
_
(
"one object in %s"
),
objdesc
);
else
/* translator: %s will always be "database %s" */
/* translator: %s will always be "database %s" */
appendStringInfo
(
descs
,
_
(
"%d objects in %s"
),
count
,
objdesc
);
appendStringInfo
(
descs
,
_
(
"%d objects in %s"
),
count
,
objdesc
);
break
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment