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

Commit9e4798e

Browse files
committed
A couple of development scripts by Dan to detect unused and duplicate
oids
1 parente8466b0 commit9e4798e

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

‎src/include/catalog/duplicate_oids

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
#
3+
# duplicate_oids
4+
#
5+
# finds oids that are duplicated in the system tables.
6+
#
7+
8+
egrep'^DATA' pg_*.h| \
9+
sed -e's/^.*OID[^=]*=[^0-9]*//' -e's/[^0-9].*$//'| \
10+
sort -n>/tmp/alloids.$$
11+
uniq /tmp/alloids.$$>/tmp/uniqoids.$$
12+
diff -u /tmp/alloids.$$ /tmp/uniqoids.$$| \
13+
grep -v'/tmp/'| \
14+
grep'^-'| \
15+
sed -e's/^-//'| \
16+
grep -v'^0$'| \
17+
uniq
18+
rm /tmp/alloids.$$
19+
rm /tmp/uniqoids.$$
20+

‎src/include/catalog/unused_oids

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
# unused_oids
3+
#
4+
# $Header: /cvsroot/pgsql/src/include/catalog/unused_oids,v 1.1 1997/03/15 06:03:08 scrappy Exp $
5+
#
6+
#finds blocks of oids that have not already been claimed by
7+
#post_hackers for internal purposes. primarily useful for
8+
#finding valid oids for new internal function oids. the numbers
9+
#printed are inclusive ranges of valid (unused) oids.
10+
#
11+
#before using a large empty block, make sure you aren't about
12+
#to take over what was intended as expansion space for something
13+
#else. also, before using a number, do a "grepsrc" to make sure
14+
#that someone isn't using a literal numeric constant somewhere..
15+
#
16+
#non-berkeley post_hackers should probably not try to use oids
17+
#less than the highest one that comes with the distributed source.
18+
#
19+
#run this script in src/backend/catalog.
20+
#
21+
egrep'^DATA' pg_*.h| \
22+
sed -e's/^.*OID[^=]*=[^0-9]*//' -e's/[^0-9].*$//'| \
23+
sort -n| \
24+
uniq| \
25+
awk'
26+
BEGIN {
27+
last = 0;
28+
}
29+
/^[0-9]/ {
30+
if ($1 > last + 1) {
31+
if ($1 > last + 2) {
32+
print last + 1, "-", $1 - 1;
33+
} else {
34+
print last + 1;
35+
}
36+
}
37+
last = $1;
38+
}
39+
END {
40+
print last + 1, "-";
41+
}'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp