1997-03-15 07:03:08 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# duplicate_oids
|
|
|
|
#
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/include/catalog/duplicate_oids
|
1997-03-15 07:03:08 +01:00
|
|
|
#
|
2005-04-13 20:54:57 +02:00
|
|
|
# finds manually-assigned oids that are duplicated in the system tables.
|
2001-09-28 10:09:14 +02:00
|
|
|
#
|
2005-04-13 20:54:57 +02:00
|
|
|
# run this script in src/include/catalog.
|
2001-09-28 10:09:14 +02:00
|
|
|
#
|
|
|
|
|
2005-04-14 03:38:22 +02:00
|
|
|
# note: we exclude BKI_BOOTSTRAP relations since they are expected to have
|
2009-09-27 00:42:03 +02:00
|
|
|
# matching DATA lines in pg_class.h and pg_type.h
|
2001-09-28 10:09:14 +02:00
|
|
|
|
2006-07-31 03:16:38 +02:00
|
|
|
cat pg_*.h toasting.h indexing.h | \
|
2005-04-14 03:38:22 +02:00
|
|
|
egrep -v -e '^CATALOG\(.*BKI_BOOTSTRAP' | \
|
|
|
|
sed -n -e 's/^DATA(insert *OID *= *\([0-9][0-9]*\).*$/\1/p' \
|
2009-09-27 00:42:03 +02:00
|
|
|
-e 's/^CATALOG([^,]*, *\([0-9][0-9]*\).*BKI_ROWTYPE_OID(\([0-9][0-9]*\)).*$/\1,\2/p' \
|
2005-04-14 03:38:22 +02:00
|
|
|
-e 's/^CATALOG([^,]*, *\([0-9][0-9]*\).*$/\1/p' \
|
|
|
|
-e 's/^DECLARE_INDEX([^,]*, *\([0-9][0-9]*\).*$/\1/p' \
|
2006-07-31 03:16:38 +02:00
|
|
|
-e 's/^DECLARE_UNIQUE_INDEX([^,]*, *\([0-9][0-9]*\).*$/\1/p' \
|
|
|
|
-e 's/^DECLARE_TOAST([^,]*, *\([0-9][0-9]*\), *\([0-9][0-9]*\).*$/\1,\2/p' | \
|
|
|
|
tr ',' '\n' | \
|
2005-04-14 03:38:22 +02:00
|
|
|
sort -n | \
|
2011-03-28 21:52:23 +02:00
|
|
|
uniq -d | \
|
|
|
|
grep '.'
|
2001-09-28 10:09:14 +02:00
|
|
|
|
2011-03-28 21:52:23 +02:00
|
|
|
# nonzero exit code if lines were produced
|
|
|
|
[ $? -eq 1 ]
|
|
|
|
exit
|