aboutsummaryrefslogtreecommitdiff
path: root/src/include/catalog/duplicate_oids
blob: ebcea8f2eca821ca3f4395ddb622cbf670eaf532 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#
# duplicate_oids
#
# finds oids that are duplicated in the system tables.
#

FILES=`ls pg_*.h`

#
# The previous version did not use the -d option on uniq
# so check here that it is supported.
# Otherwise, use the old algorithm
#

if [ `uniq -d < /dev/null > /dev/null 2>&1` ]; then
  echo "uniq -d is not supported on your platform."
  echo "Please report this to pgsql-hackers@postgresql.org"

egrep '^DATA' $FILES | \
	sed -e 's/^.*OID[^=]*=[^0-9]*//' -e 's/[^0-9].*$//' | \
	sort -n >/tmp/alloids.$$
uniq /tmp/alloids.$$ >/tmp/uniqoids.$$

diff -u /tmp/alloids.$$ /tmp/uniqoids.$$ | \
	grep -v '/tmp/' | \
	grep '^-' | \
	sed -e 's/^-//' | \
	grep -v '^0$' | \
	uniq
rm /tmp/alloids.$$
rm /tmp/uniqoids.$$

else

#  echo "uniq -d is supported on this platform."
#  echo "Will omit the use of temporary files."

egrep '^DATA' $FILES | \
	sed -e 's/^.*OID[^=]*=[^0-9]*//' -e 's/[^0-9].*$//' | \
	sort -n | uniq -d | \
	egrep -v '^[0]*$'

fi

exit