diff --git a/GNUmakefile.in b/GNUmakefile.in
index b9c5f31..f3c5fe5 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -65,6 +65,8 @@ $(call recurse,check-world,src/test src/pl src/interfaces/ecpg,check)
 
 $(call recurse,installcheck-world,src/test src/pl src/interfaces/ecpg contrib,installcheck)
 
+$(call recurse,maintainer-check,doc src config contrib)
+
 GNUmakefile: GNUmakefile.in $(top_builddir)/config.status
 	./config.status $@
 
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index add2c28..3041a53 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -279,7 +279,7 @@ MAKEINFO = makeinfo
 ##
 
 # Quick syntax check without style processing
-check: postgres.sgml $(ALMOSTALLSGML) check-tabs
+check maintainer-check: postgres.sgml $(ALMOSTALLSGML) check-tabs
 	$(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
 
 
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 2eff4d4..69512ac 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -18,9 +18,9 @@
 #
 # Meta configuration
 
-standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check installcheck
+standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check installcheck maintainer-check
 
-.PHONY: $(standard_targets) install-strip maintainer-check html man installcheck-parallel
+.PHONY: $(standard_targets) install-strip html man installcheck-parallel
 
 # make `all' the default target
 all:
diff --git a/src/include/Makefile b/src/include/Makefile
index 0d5f049..1bfb4a7 100644
--- a/src/include/Makefile
+++ b/src/include/Makefile
@@ -67,3 +67,6 @@ clean:
 
 distclean maintainer-clean: clean
 	rm -f pg_config.h dynloader.h pg_config_os.h stamp-h
+
+maintainer-check:
+	cd catalog && ./duplicate_oids
diff --git a/src/include/catalog/duplicate_oids b/src/include/catalog/duplicate_oids
index 3f3d9f6..82c12f3 100755
--- a/src/include/catalog/duplicate_oids
+++ b/src/include/catalog/duplicate_oids
@@ -22,6 +22,9 @@ sed -n	-e 's/^DATA(insert *OID *= *\([0-9][0-9]*\).*$/\1/p' \
 	-e 's/^DECLARE_TOAST([^,]*, *\([0-9][0-9]*\), *\([0-9][0-9]*\).*$/\1,\2/p' | \
 tr ',' '\n' | \
 sort -n | \
-uniq -d
+uniq -d | \
+grep '.'
 
-exit 0
+# nonzero exit code if lines were produced
+[ $? -eq 1 ]
+exit
