From 68cb2d69c41e8553d61e6d43ee6e473f5b4f5a69 Mon Sep 17 00:00:00 2001
From: John Naylor <jcnaylor@gmail.com>
Date: Thu, 14 Dec 2017 11:52:37 +0700
Subject: [PATCH v4 01/12] Fix typos and oversights in catalog headers

---
 src/backend/catalog/Catalog.pm             |  3 ++-
 src/backend/catalog/Makefile               |  2 +-
 src/backend/utils/Gen_fmgrtab.pl           |  6 ++++--
 src/include/catalog/pg_partitioned_table.h |  2 +-
 src/include/catalog/pg_sequence.h          | 10 ++++++++++
 src/include/catalog/pg_statistic.h         | 10 ++++------
 src/include/catalog/pg_subscription_rel.h  |  5 +----
 7 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index 54f8353..0b260ec 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -36,7 +36,8 @@ sub Catalogs
 		'int64'         => 'int8',
 		'Oid'           => 'oid',
 		'NameData'      => 'name',
-		'TransactionId' => 'xid');
+		'TransactionId' => 'xid',
+		'XLogRecPtr'    => 'pg_lsn');
 
 	foreach my $input_file (@_)
 	{
diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile
index fd33426..30ca509 100644
--- a/src/backend/catalog/Makefile
+++ b/src/backend/catalog/Makefile
@@ -45,7 +45,7 @@ POSTGRES_BKI_SRCS = $(addprefix $(top_srcdir)/src/include/catalog/,\
 	pg_default_acl.h pg_init_privs.h pg_seclabel.h pg_shseclabel.h \
 	pg_collation.h pg_partitioned_table.h pg_range.h pg_transform.h \
 	pg_sequence.h pg_publication.h pg_publication_rel.h pg_subscription.h \
-	pg_subscription_rel.h toasting.h indexing.h \
+	pg_subscription_rel.h \
 	toasting.h indexing.h \
     )
 
diff --git a/src/backend/utils/Gen_fmgrtab.pl b/src/backend/utils/Gen_fmgrtab.pl
index 26b428b..cd399c9 100644
--- a/src/backend/utils/Gen_fmgrtab.pl
+++ b/src/backend/utils/Gen_fmgrtab.pl
@@ -2,7 +2,8 @@
 #-------------------------------------------------------------------------
 #
 # Gen_fmgrtab.pl
-#    Perl script that generates fmgroids.h and fmgrtab.c from pg_proc.h
+#    Perl script that generates fmgroids.h, fmgrprotos.h, and fmgrtab.c
+#    from pg_proc.h
 #
 # Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
@@ -281,7 +282,8 @@ sub usage
 	die <<EOM;
 Usage: perl -I [directory of Catalog.pm] Gen_fmgrtab.pl [path to pg_proc.h]
 
-Gen_fmgrtab.pl generates fmgroids.h and fmgrtab.c from pg_proc.h
+Gen_fmgrtab.pl generates fmgroids.h, fmgrprotos.h, and fmgrtab.c from
+pg_proc.h
 
 Report bugs to <pgsql-bugs\@postgresql.org>.
 EOM
diff --git a/src/include/catalog/pg_partitioned_table.h b/src/include/catalog/pg_partitioned_table.h
index 525e541..731147e 100644
--- a/src/include/catalog/pg_partitioned_table.h
+++ b/src/include/catalog/pg_partitioned_table.h
@@ -10,7 +10,7 @@
  * src/include/catalog/pg_partitioned_table.h
  *
  * NOTES
- *	  the genbki.sh script reads this file and generates .bki
+ *	  the genbki.pl script reads this file and generates .bki
  *	  information from the DATA() statements.
  *
  *-------------------------------------------------------------------------
diff --git a/src/include/catalog/pg_sequence.h b/src/include/catalog/pg_sequence.h
index 8ae6b71..6de54bb 100644
--- a/src/include/catalog/pg_sequence.h
+++ b/src/include/catalog/pg_sequence.h
@@ -1,3 +1,13 @@
+/* -------------------------------------------------------------------------
+ *
+ * pg_sequence.h
+ *	  definition of the system "sequence" relation (pg_sequence)
+ *
+ * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * -------------------------------------------------------------------------
+ */
 #ifndef PG_SEQUENCE_H
 #define PG_SEQUENCE_H
 
diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h
index 3713a56..43128f1 100644
--- a/src/include/catalog/pg_statistic.h
+++ b/src/include/catalog/pg_statistic.h
@@ -161,12 +161,10 @@ typedef FormData_pg_statistic *Form_pg_statistic;
 #define Anum_pg_statistic_stavalues5	26
 
 /*
- * Currently, five statistical slot "kinds" are defined by core PostgreSQL,
- * as documented below.  Additional "kinds" will probably appear in
- * future to help cope with non-scalar datatypes.  Also, custom data types
- * can define their own "kind" codes by mutual agreement between a custom
- * typanalyze routine and the selectivity estimation functions of the type's
- * operators.
+ * Several statistical slot "kinds" are defined by core PostgreSQL, as
+ * documented below.  Also, custom data types can define their own "kind"
+ * codes by mutual agreement between a custom typanalyze routine and the
+ * selectivity estimation functions of the type's operators.
  *
  * Code reading the pg_statistic relation should not assume that a particular
  * data "kind" will appear in any particular slot.  Instead, search the
diff --git a/src/include/catalog/pg_subscription_rel.h b/src/include/catalog/pg_subscription_rel.h
index 991ca9d..5748297 100644
--- a/src/include/catalog/pg_subscription_rel.h
+++ b/src/include/catalog/pg_subscription_rel.h
@@ -23,15 +23,12 @@
  */
 #define SubscriptionRelRelationId			6102
 
-/* Workaround for genbki not knowing about XLogRecPtr */
-#define pg_lsn XLogRecPtr
-
 CATALOG(pg_subscription_rel,6102) BKI_WITHOUT_OIDS
 {
 	Oid			srsubid;		/* Oid of subscription */
 	Oid			srrelid;		/* Oid of relation */
 	char		srsubstate;		/* state of the relation in subscription */
-	pg_lsn		srsublsn;		/* remote lsn of the state change used for
+	XLogRecPtr	srsublsn;		/* remote lsn of the state change used for
 								 * synchronization coordination */
 } FormData_pg_subscription_rel;
 
-- 
2.7.4

