Index: src/backend/Makefile
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/Makefile,v
retrieving revision 1.132
diff -c -p -r1.132 Makefile
*** src/backend/Makefile	1 Jan 2009 17:23:34 -0000	1.132
--- src/backend/Makefile	12 Aug 2009 21:47:07 -0000
*************** endif
*** 105,112 ****
  endif # aix
  
  # Update the commonly used headers before building the subdirectories
! $(SUBDIRS:%=%-recursive): $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/probes.h
! 
  
  # The postgres.o target is needed by the rule in Makefile.global that
  # creates the exports file when MAKE_EXPORTS = true.
--- 105,111 ----
  endif # aix
  
  # Update the commonly used headers before building the subdirectories
! $(SUBDIRS:%=%-recursive): $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/probes.h $(top_builddir)/src/include/catalog/schemapg.h
  
  # The postgres.o target is needed by the rule in Makefile.global that
  # creates the exports file when MAKE_EXPORTS = true.
*************** $(srcdir)/parser/gram.h: parser/gram.y
*** 124,129 ****
--- 123,131 ----
  utils/fmgroids.h: utils/Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc.h
  	$(MAKE) -C utils fmgroids.h
  
+ catalog/schemapg.h: utils/gen_schemapg.pl $(wildcard $(top_srcdir)/src/include/catalog/pg_*.h)
+ 	$(MAKE) -C utils schemapg.h
+ 
  utils/probes.h: utils/probes.d
  	$(MAKE) -C utils probes.h
  
*************** $(top_builddir)/src/include/utils/fmgroi
*** 140,145 ****
--- 142,151 ----
  	cd $(dir $@) && rm -f $(notdir $@) && \
  	    $(LN_S) ../../../$(subdir)/utils/fmgroids.h .
  
+ $(top_builddir)/src/include/catalog/schemapg.h: utils/schemapg.h
+ 	cd $(dir $@) && rm -f $(notdir $@) && \
+ 		$(LN_S) ../../../$(subdir)/utils/schemapg.h .
+ 
  $(top_builddir)/src/include/utils/probes.h: utils/probes.h
  	cd $(dir $@) && rm -f $(notdir $@) && \
  	    $(LN_S) ../../../$(subdir)/utils/probes.h .
Index: src/backend/utils/Makefile
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/Makefile,v
retrieving revision 1.28
diff -c -p -r1.28 Makefile
*** src/backend/utils/Makefile	1 Aug 2008 13:16:09 -0000	1.28
--- src/backend/utils/Makefile	12 Aug 2009 21:47:37 -0000
*************** $(SUBDIRS:%=%-recursive): fmgroids.h
*** 20,25 ****
--- 20,28 ----
  fmgroids.h fmgrtab.c: Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc.h
  	AWK='$(AWK)' $(SHELL) $< $(top_srcdir)/src/include/catalog/pg_proc.h
  
+ schemapg.h: gen_schemapg.pl $(wildcard $(top_srcdir)/src/include/catalog/*.h)
+ 	$(PERL) $< -I$(top_srcdir)/src/include --set-version=$(VERSION) $(wildcard $(top_srcdir)/src/include/catalog/*.h)
+ 
  ifneq ($(enable_dtrace), yes)
  probes.h: Gen_dummy_probes.sed
  endif
Index: src/backend/utils/gen_schemapg.pl
===================================================================
RCS file: src/backend/utils/gen_schemapg.pl
diff -N src/backend/utils/gen_schemapg.pl
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- src/backend/utils/gen_schemapg.pl	12 Aug 2009 22:12:02 -0000
***************
*** 0 ****
--- 1,371 ----
+ #!/usr/bin/perl
+ #
+ # gen_schemapg.pl
+ #		The purpose of this script is to generate the schemapg.h header.
+ #
+ # Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
+ # Portions Copyright (c) 1994, Regents of the University of California
+ #
+ # $PostgreSQL$
+ 
+ use strict;
+ use warnings;
+ 
+ my @OUTPUT = (
+ 	[ 'schemapg.h', \*SCHEMAPG ],
+ );
+ 
+ #
+ # There are a few types which are given one name in the C source, but a
+ # different name at the SQL level.  These are enumerated here.
+ #
+ my %RENAME_ATTTYPE = (
+ 	'Oid' => 'oid',
+ 	'NameData' => 'name',
+ 	'TransactionId' => 'xid'
+ );
+ 
+ #
+ # Argument parsing.  We could use GetOpt::Long or similar here, but doing it
+ # this way avoids depending on any outside modules.
+ #
+ my @include_path;
+ my @input_file;
+ my $output_path = '';
+ my $major_version;
+ while (@ARGV) {
+ 	my $arg = shift @ARGV;
+ 	if ($arg !~ /^-/) {
+ 		push @input_file, $arg;
+ 	}
+ 	elsif ($arg =~ /^-I/) {
+ 		push @include_path, length($arg) > 2 ? substr($arg, 2) : shift @ARGV;
+ 	}
+ 	elsif ($arg =~ /^--set-version=(.*)$/) {
+ 		$major_version = $1;
+ 		# Remove minor version information, if any.
+ 		if ($major_version =~ /^(\d+.\d+)/) {
+ 			$major_version = $1;
+ 		}
+ 	}
+ 	else {
+ 		usage();
+ 	}
+ }
+ 
+ # Sanity check arguments.
+ die "No input files.\n" if ! @input_file;
+ die "No include path; you must specify -I at least once.\n" if ! @include_path;
+ die "No version specified.\n" if !defined $major_version;
+ 
+ #
+ # CAUTION: be wary about what symbols you substitute into the .bki file here!
+ # It's okay to substitute things that are expected to be really constant
+ # within a given Postgres release, such as fixed OIDs.  Do not substitute
+ # anything that could depend on platform or configuration.  (The right place
+ # to handle those sorts of things is in initdb.c's bootstrap_template1().)
+ #
+ my $BOOTSTRAP_SUPERUSERID =
+ 	find_defined_symbol('pg_authid.h', 'BOOTSTRAP_SUPERUSERID');
+ my $PG_CATALOG_NAMESPACE =
+ 	find_defined_symbol('pg_namespace.h', 'PG_CATALOG_NAMESPACE');
+ my $INTERNAL_LANGUAGE_ID =
+ 	find_defined_symbol('pg_language.h', 'INTERNALlanguageId');
+ 
+ # Make sure output_path ends in a slash.
+ if ($output_path ne '' && substr($output_path, -1) ne '/') {
+ 	$output_path .= '/';
+ }
+ 
+ # Open temporary output files.
+ for my $output (@OUTPUT) {
+ 	my $temp_name = $output_path . $output->[0] . '.tmp';
+ 	# We avoid using the three-argument form of open() here, because it is
+ 	# only supported in Perl 5.6 and higher.
+ 	open($output->[1], ">$temp_name") || die "$temp_name: $!";
+ }
+ 
+ # Opening boilerplate for schemapg.h
+ print SCHEMAPG <<EOM;
+ /*-------------------------------------------------------------------------
+  *
+  * schemapg.h
+  *    Schema_pg_xxx macros for use by relcache.c
+  *
+  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
+  * Portions Copyright (c) 1994, Regents of the University of California
+  *
+  * NOTES
+  *	******************************
+  *	*** DO NOT EDIT THIS FILE! ***
+  *	******************************
+  *
+  *	It has been GENERATED by $0
+  *
+  *-------------------------------------------------------------------------
+  */
+ #ifndef SCHEMAPG_H
+ #define SCHEMAPG_H
+ 
+ EOM
+ 
+ # Main part of the work: read and process each header file.
+ my (%schema_pg, %catalog_name);
+ for my $input_file (@input_file)
+ {
+ 	process_input_file($input_file);
+ }
+ 
+ # Emit Schema_pg_xxx declarations.
+ while (my ($oid, $entry_list) = each %schema_pg) {
+ 	my $catalog = $catalog_name{$oid};
+ 	die "catalog with oid $oid not found" if !defined $catalog;
+ 	print SCHEMAPG "#define Schema_$catalog \\\n",
+ 		join(", \\\n", @$entry_list), "\n\n";
+ }
+ 
+ # Closing boilerplate for schemapg.h
+ print SCHEMAPG "#endif /* SCHEMAPG_H */\n";
+ 
+ # Close output files.
+ for my $output (@OUTPUT) {
+ 	my $temp_name = $output_path . $output->[0] . '.tmp';
+ 	close($output->[1]) || die "close: $temp_name: $!";
+ }
+ 
+ # Rename temporary files to final names, if anything has changed.
+ for my $output (@OUTPUT) {
+ 	rename_output($output_path, $output->[0]);
+ }
+ 
+ 
+ exit 0;
+ 
+ #
+ # Read and process a single input file.
+ #
+ sub process_input_file {
+ 	my ($input_file) = @_;
+ 	open(INPUT_FILE, "<$input_file") || die "$input_file: $!";
+ 
+ 	# State we need to keep track of while scanning the file.
+ 	my ($catalog, $declaring_attributes);
+ 	my (@bki_attr, @attname, %attname_to_attnum, %attname_to_atttype);
+ 
+ 	# Scan the input file.
+ 	while (<INPUT_FILE>) {
+ 		# Strip C-style comments.
+ 		s;/\*(.|\n)*\*/;;g;
+ 		if (m;/\*;) {
+ 			my $next_line = <INPUT_FILE>;
+ 			die "$input_file: ends within C-style comment\n"
+ 				if !defined $next_line;
+ 			$_ .= $next_line;
+ 			redo;
+ 		}
+ 
+ 		# Strip useless whitespace and trailing semicolons.
+ 		chomp;
+ 		s/^\s+//;
+ 		s/;\s*$//;
+ 		s/\s+/ /g;
+ 
+ 		#
+ 		# DATA lines are passed through to postgres.bki after stripping off
+ 		# the DATA( and the ) on the end.  Remember the OID for use by
+ 		# DESCR() and SHDESCR().
+ 		#
+ 		# In addition, when processing pg_proc.h, we extract all of the
+ 		# "internal" functions and save them so that we can eventually write
+ 		# them out to fmgroids.h and fmgrtab.h.
+ 		#
+ 		if (/^DATA\((insert(\s+OID\s+=\s+(\d+))?\s+\((.*)\))\s*\)$/) {
+ 			my ($data, $field_data) = ($1, $4);
+ 			# Pass the (almost) raw data through to postgres.bki.
+ 			$data =~ s/\bPGUID\b/$BOOTSTRAP_SUPERUSERID/g;
+ 			$data =~ s/\bPGNSP\b/$PG_CATALOG_NAMESPACE/g;
+ 			# To construct fmgroids.h and fmgrtab.c, we need to inspect some
+ 			# of the individual data fields.  Just splitting on whitespace
+ 			# won't work, because some quoted fields might contain internal
+ 			# whitespace.  We handle this by folding them all to a simple
+ 			# "xxx". Fortunately, this script doesn't need to look at any
+ 			# fields that might need quoting, so this simple hack is
+ 			# sufficient.
+ 			if (defined $catalog) {
+ 				$field_data =~ s/^\s+//;
+ 				$field_data =~ s/"[^"]*"/"xxx"/g;
+ 				my @p = split /\s+/, $field_data;
+ 
+ 				# Extract Schema_pg info for non-system attributes.
+ 				if ($catalog eq 'pg_attribute'
+ 					&& $p[$attname_to_attnum{'attnum'}-1] > 0) {
+ 					if (@attname != @p) {
+ 						die sprintf "catalog has %d attributes, DATA() has "
+ 							. "%d entries\n", 0+@attname, 0+@p;
+ 					}
+ 					my @cvalue;
+ 					for (my $i = 0; $i < @p; ++$i) {
+ 						my $attname = $attname[$i];
+ 						my $atttype = $attname_to_atttype{$attname};
+ 						if (grep { $atttype eq $_ } qw(oid int2 int4 float4)) {
+ 							push @cvalue, $p[$i];
+ 						}
+ 						elsif ($atttype eq 'aclitem[]') {
+ 							if ($p[$i] ne '_null_') {
+ 								die "can't handle non-null aclitem[]: $p[$i]";
+ 							}
+ 							push @cvalue, '{ 0 }';
+ 						}
+ 						elsif ($atttype eq 'bool') {
+ 							if ($p[$i] eq 't') {
+ 								push @cvalue, 'true';
+ 							}
+ 							elsif ($p[$i] eq 'f') {
+ 								push @cvalue, 'false';
+ 							}
+ 							else {
+ 								# May be a constant, like FLOAT4PASSBYVAL.
+ 								push @cvalue, $p[$i];
+ 							}
+ 						}
+ 						elsif ($atttype eq 'char') {
+ 							push @cvalue, "'$p[$i]'";
+ 						}
+ 						elsif ($atttype eq 'name') {
+ 							push @cvalue, "{\"$p[$i]\"}";
+ 						}
+ 						else {
+ 							die "unhandled type $atttype";
+ 						}
+ 					}
+ 				    my $attrelid = $p[$attname_to_attnum{'attrelid'}-1];
+ 					push @{$schema_pg{$attrelid}},
+ 						"{ " . join(", ", @cvalue) . " }";
+ 				}
+ 			}
+ 		}
+ 		elsif (/^DESCR\(\"(.*)\"\)$/) {
+ 			;	# ignore it
+ 		}
+ 		elsif (/^SHDESCR\(\"(.*)\"\)$/) {
+ 			;	# ignore it
+ 		}
+ 		elsif (/^DECLARE_(UNIQUE_)?INDEX\((\s*[\w+]*),\s*(\d+),\s*(.*)\)/) {
+ 			;	# ignore it
+ 		}
+ 		elsif (/^DECLARE_TOAST\((\s*[\w+]*),\s*(\d+),\s*(\d+)\)/) {
+ 			;	# ignore it
+ 		}
+ 		elsif (/^BUILD_INDICES/) {
+ 			;	# ignore it
+ 		}
+ 		elsif (/^CATALOG\(([^,]*),(.*)\)/) {
+ 			my ($catname, $catoid) = ($1, $2);
+ 			$catalog = $catname;
+ 			$declaring_attributes = 1;
+ 			undef %attname_to_attnum;
+ 			undef %attname_to_atttype;
+ 			undef @attname;
+ 			$catalog_name{$catoid} = $catname;
+ 		}
+ 		elsif ($declaring_attributes) {
+ 			if ($_ =~ /^{|^$/) {
+ 				;							# just ignore it
+ 			}
+ 			elsif ($_ =~ /^}/)	{
+ 				undef $declaring_attributes;
+ 			}
+ 			else {
+ 				my @datafields = split /\s+/, $_;
+ 				my $atttype = $datafields[0];
+ 				my $attname;
+ 				if (exists $RENAME_ATTTYPE{$atttype}) {
+ 					$atttype = $RENAME_ATTTYPE{$atttype};
+ 				}
+ 		        if ($datafields[1] =~ /(.*)\[.*\]/) {   # array attribute
+ 	                $attname = $1;
+ 	                $atttype .= "[]";  					# variable-length only
+ 				}
+ 				else {
+ 					$attname = $datafields[1];
+ 				}
+ 				push @bki_attr, " $attname = $atttype";
+ 				push @attname, $attname;
+ 				$attname_to_attnum{$attname} = 0+@bki_attr;
+ 				$attname_to_atttype{$attname} = $atttype;
+ 			}
+ 		}
+ 		elsif (/^(DATA|CATALOG|DECLARE_(INDEX|UNIQUE_INDEX|TOAST))/) {
+ 			die "malformed $1 line ($input_file)";
+ 		}
+ 	}
+ 	close(INPUT_FILE);
+ }
+ 
+ #
+ # Find a symbol defined in a particular header file and extract the value.
+ #
+ sub find_defined_symbol {
+ 	my ($catalog_header, $symbol) = @_;
+ 	for my $path (@include_path) {
+ 		my $file = $path . '/catalog/' . $catalog_header;
+ 		next if ! -f $file;
+ 		# We avoid using the three-argument form of open() here, because it is
+ 		# only supported in Perl 5.6 and higher.
+ 		open(FIND_DEFINED_SYMBOL, "<$file") || die "$file: $!";
+ 		while (<FIND_DEFINED_SYMBOL>) {
+ 			if (/^#define\s+\Q$symbol\E\s+(\S+)/) {
+ 				return $1;
+ 			}
+ 		}
+ 		close(FIND_DEFINED_SYMBOL);
+ 		die "$file: no definition found for $symbol\n";
+ 	}
+ 	die "$catalog_header: not found in any include directory\n";
+ }
+ 
+ sub rename_output {
+ 	my $output_path = shift;
+ 	my $output = shift;
+ 
+ 	my $temp_name = $output_path . $output . '.tmp';
+ 	my $final_name = $output_path . $output;
+ 	if (-e $final_name && -s $temp_name == -s $final_name) {
+ 		open(TN, "<$temp_name") || die "$temp_name: $!";
+ 		if (open(FN, "<$temp_name")) {
+ 			local $/ = undef;
+ 			my $tn = <TN>;
+ 			my $fn = <FN>;
+ 			close(FN);
+ 			if ($tn eq $fn) {
+ 				print "$output unchanged, not replacing\n";
+ 				close(TN);
+ 				# don't die -- not fatal
+ 				unlink($temp_name) || print "unlink: $temp_name: $!\n";
+ 				return;
+ 			}
+ 		}
+ 		close(TN);
+ 	}
+ 	rename($temp_name, $final_name) || die "rename: $temp_name: $!";
+ }
+ 
+ #
+ # Display usage message and exit.
+ #
+ sub usage
+ {
+ 	die <<EOM;
+ Usage: $0 [options] header...
+ 
+ Options:
+ 	-I				path to include files
+ 	--bki			prefix for BKI output files
+ 	--set-version	PostgreSQL version number for initdb cross-check
+ 
+ genbki.pl generates .bki files from specially formatted .h files.  These .bki
+ files are used to initialize the postgres template database.
+ 
+ Report bugs to <pgsql-bugs\@postgresql.org>.
+ EOM
+ }
Index: src/backend/utils/cache/relcache.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/cache/relcache.c,v
retrieving revision 1.289
diff -c -p -r1.289 relcache.c
*** src/backend/utils/cache/relcache.c	12 Aug 2009 20:53:30 -0000	1.289
--- src/backend/utils/cache/relcache.c	12 Aug 2009 21:20:21 -0000
***************
*** 50,55 ****
--- 50,56 ----
  #include "catalog/pg_rewrite.h"
  #include "catalog/pg_tablespace.h"
  #include "catalog/pg_type.h"
+ #include "catalog/schemapg.h"
  #include "commands/trigger.h"
  #include "miscadmin.h"
  #include "optimizer/clauses.h"
Index: src/include/catalog/pg_attribute.h
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/include/catalog/pg_attribute.h,v
retrieving revision 1.152
diff -c -p -r1.152 pg_attribute.h
*** src/include/catalog/pg_attribute.h	12 Aug 2009 20:53:30 -0000	1.152
--- src/include/catalog/pg_attribute.h	12 Aug 2009 21:36:04 -0000
***************
*** 14,23 ****
   *	  the genbki.sh script reads this file and generates .bki
   *	  information from the DATA() statements.
   *
!  *	  utils/cache/relcache.c requires hard-coded tuple descriptors
!  *	  for some of the system catalogs.	So if the schema for any of
!  *	  these changes, be sure and change the appropriate Schema_xxx
!  *	  macros!  -cim 2/5/91
   *
   *-------------------------------------------------------------------------
   */
--- 14,25 ----
   *	  the genbki.sh script reads this file and generates .bki
   *	  information from the DATA() statements.
   *
!  *	  utils/cache/relcache.c requires hard-coded tuple descriptors for some of
!  *	  the system catalogs.	Catalogs that are declared here with DATA
!  *	  statements have their Schema_xxx macros automatically generated by the
!  *	  gen_schemapg.pl script.  Other catalogs do not have DATA() statements
!  *	  here but still need a Schema_xxx macro, and are declared below.
!  *	  -cim 2/5/91
   *
   *-------------------------------------------------------------------------
   */
*************** typedef FormData_pg_attribute *Form_pg_a
*** 219,254 ****
   *		pg_type
   * ----------------
   */
- #define Schema_pg_type \
- { 1247, {"typname"},	   19, -1, 0, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typnamespace"},  26, -1, 0,	4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typowner"},	   26, -1, 0,	4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typlen"},		   21, -1, 0,	2,	4, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typbyval"},	   16, -1, 0,	1,	5, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typtype"},	   18, -1, 0,	1,	6, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typcategory"},   18, -1, 0,	1,	7, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typispreferred"},16, -1, 0,	1,	8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typisdefined"},  16, -1, 0,	1,	9, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typdelim"},	   18, -1, 0,	1, 10, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typrelid"},	   26, -1, 0,	4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typelem"},	   26, -1, 0,	4, 12, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typarray"},	   26, -1, 0,	4, 13, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typinput"},	   24, -1, 0,	4, 14, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typoutput"},	   24, -1, 0,	4, 15, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typreceive"},    24, -1, 0,	4, 16, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typsend"},	   24, -1, 0,	4, 17, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typmodin"},	   24, -1, 0,	4, 18, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typmodout"},	   24, -1, 0,	4, 19, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typanalyze"},    24, -1, 0,	4, 20, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typalign"},	   18, -1, 0,	1, 21, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typstorage"},    18, -1, 0,	1, 22, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typnotnull"},    16, -1, 0,	1, 23, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typbasetype"},   26, -1, 0,	4, 24, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typtypmod"},	   23, -1, 0,	4, 25, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typndims"},	   23, -1, 0,	4, 26, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1247, {"typdefaultbin"}, 25, -1, 0, -1, 27, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
- { 1247, {"typdefault"},    25, -1, 0, -1, 28, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }
- 
  DATA(insert ( 1247 typname			19 -1 0 NAMEDATALEN	1 0 -1 -1 f p c t f f t 0 _null_));
  DATA(insert ( 1247 typnamespace		26 -1 0 4   2 0 -1 -1 t p i t f f t 0 _null_));
  DATA(insert ( 1247 typowner			26 -1 0 4   3 0 -1 -1 t p i t f f t 0 _null_));
--- 221,226 ----
*************** DATA(insert ( 1247 tableoid			26 0 0  4 
*** 289,320 ****
   *		pg_proc
   * ----------------
   */
- #define Schema_pg_proc \
- { 1255, {"proname"},			19, -1, 0, NAMEDATALEN,  1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1255, {"pronamespace"},		26, -1, 0, 4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1255, {"proowner"},			26, -1, 0, 4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1255, {"prolang"},			26, -1, 0, 4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1255, {"procost"},		   700, -1, 0, 4,	5, 0, -1, -1, FLOAT4PASSBYVAL, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1255, {"prorows"},		   700, -1, 0, 4,	6, 0, -1, -1, FLOAT4PASSBYVAL, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1255, {"provariadic"},		26, -1, 0, 4,	7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1255, {"proisagg"},			16, -1, 0, 1,	8, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1255, {"proiswindow"},		16, -1, 0, 1,	9, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1255, {"prosecdef"},			16, -1, 0, 1, 10, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1255, {"proisstrict"},		16, -1, 0, 1, 11, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1255, {"proretset"},			16, -1, 0, 1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1255, {"provolatile"},		18, -1, 0, 1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1255, {"pronargs"},			21, -1, 0, 2, 14, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, { 0 } }, \
- { 1255, {"pronargdefaults"},	21, -1, 0, 2, 15, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, { 0 } }, \
- { 1255, {"prorettype"},			26, -1, 0, 4, 16, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1255, {"proargtypes"},		30, -1, 0, -1, 17, 1, -1, -1, false, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1255, {"proallargtypes"},   1028, -1, 0, -1, 18, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
- { 1255, {"proargmodes"},	  1002, -1, 0, -1, 19, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
- { 1255, {"proargnames"},	  1009, -1, 0, -1, 20, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
- { 1255, {"proargdefaults"},		25, -1, 0, -1, 21, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
- { 1255, {"prosrc"},				25, -1, 0, -1, 22, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
- { 1255, {"probin"},				25, -1, 0, -1, 23, 0, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
- { 1255, {"proconfig"},		  1009, -1, 0, -1, 24, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
- { 1255, {"proacl"},			  1034, -1, 0, -1, 25, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }
  
  DATA(insert ( 1255 proname			19 -1 0 NAMEDATALEN	1 0 -1 -1 f p c t f f t 0 _null_));
  DATA(insert ( 1255 pronamespace		26 -1 0 4   2 0 -1 -1 t p i t f f t 0 _null_));
--- 261,266 ----
*************** DATA(insert ( 1255 tableoid			26 0 0  4 
*** 353,379 ****
   *		pg_attribute
   * ----------------
   */
- #define Schema_pg_attribute \
- { 1249, {"attrelid"},	  26, -1, 0,	4,	1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attname"},	  19, -1, 0, NAMEDATALEN,	2, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1249, {"atttypid"},	  26, -1, 0,	4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attstattarget"}, 23, -1, 0,	4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attdistinct"}, 700, -1, 0,	4,	5, 0, -1, -1, FLOAT4PASSBYVAL, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attlen"},		  21, -1, 0,	2,	6, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attnum"},		  21, -1, 0,	2,	7, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attndims"},	  23, -1, 0,	4,	8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attcacheoff"},  23, -1, 0,	4,	9, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1249, {"atttypmod"},	  23, -1, 0,	4, 10, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attbyval"},	  16, -1, 0,	1, 11, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attstorage"},   18, -1, 0,	1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attalign"},	  18, -1, 0,	1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attnotnull"},   16, -1, 0,	1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1249, {"atthasdef"},	  16, -1, 0,	1, 15, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attisdropped"}, 16, -1, 0,	1, 16, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attislocal"},   16, -1, 0,	1, 17, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attinhcount"},  23, -1, 0,	4, 18, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1249, {"attacl"},		1034, -1, 0,  -1, 19, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }
- 
  DATA(insert ( 1249 attrelid			26 -1 0  4   1 0 -1 -1 t p i t f f t 0 _null_));
  DATA(insert ( 1249 attname			19 -1 0 NAMEDATALEN  2 0 -1 -1 f p c t f f t 0 _null_));
  DATA(insert ( 1249 atttypid			26 -1 0  4   3 0 -1 -1 t p i t f f t 0 _null_));
--- 299,304 ----
*************** DATA(insert ( 1249 tableoid			26 0 0  4 
*** 405,437 ****
   *		pg_class
   * ----------------
   */
- #define Schema_pg_class \
- { 1259, {"relname"},	   19, -1, 0, NAMEDATALEN, 1, 0, -1, -1, false, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relnamespace"},  26, -1, 0,	4,	2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"reltype"},	   26, -1, 0,	4,	3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relowner"},	   26, -1, 0,	4,	4, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relam"},		   26, -1, 0,	4,	5, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relfilenode"},   26, -1, 0,	4,	6, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"reltablespace"}, 26, -1, 0,	4,	7, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relpages"},	   23, -1, 0,	4,	8, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"reltuples"},	   700, -1, 0, 4,	9, 0, -1, -1, FLOAT4PASSBYVAL, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"reltoastrelid"}, 26, -1, 0,	4, 10, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"reltoastidxid"}, 26, -1, 0,	4, 11, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relhasindex"},   16, -1, 0,	1, 12, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relisshared"},   16, -1, 0,	1, 13, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relistemp"},	   16, -1, 0,	1, 14, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relkind"},	   18, -1, 0,	1, 15, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relnatts"},	   21, -1, 0,	2, 16, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relchecks"},	   21, -1, 0,	2, 17, 0, -1, -1, true, 'p', 's', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relhasoids"},    16, -1, 0,	1, 18, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relhaspkey"},    16, -1, 0,	1, 19, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relhasrules"},   16, -1, 0,	1, 20, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relhastriggers"},16, -1, 0,	1, 21, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relhassubclass"},16, -1, 0,	1, 22, 0, -1, -1, true, 'p', 'c', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relfrozenxid"},  28, -1, 0,	4, 23, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0, { 0 } }, \
- { 1259, {"relacl"},		 1034, -1, 0, -1, 24, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }, \
- { 1259, {"reloptions"},  1009, -1, 0, -1, 25, 1, -1, -1, false, 'x', 'i', false, false, false, true, 0, { 0 } }
- 
  DATA(insert ( 1259 relname			19 -1 0 NAMEDATALEN	1 0 -1 -1 f p c t f f t 0 _null_));
  DATA(insert ( 1259 relnamespace		26 -1 0 4   2 0 -1 -1 t p i t f f t 0 _null_));
  DATA(insert ( 1259 reltype			26 -1 0 4   3 0 -1 -1 t p i t f f t 0 _null_));
--- 330,335 ----
*************** DATA(insert ( 1259 xmax				28 0 0  4  -5
*** 465,476 ****
  DATA(insert ( 1259 cmax				29 0 0  4  -6 0 -1 -1 t p i t f f t 0 _null_));
  DATA(insert ( 1259 tableoid			26 0 0  4  -7 0 -1 -1 t p i t f f t 0 _null_));
  
  /* ----------------
   *		pg_database
-  *
-  * pg_database is not bootstrapped in the same way as the other relations that
-  * have hardwired pg_attribute entries in this file.  However, we do need
-  * a "Schema_xxx" macro for it --- see relcache.c.
   * ----------------
   */
  #define Schema_pg_database \
--- 363,378 ----
  DATA(insert ( 1259 cmax				29 0 0  4  -6 0 -1 -1 t p i t f f t 0 _null_));
  DATA(insert ( 1259 tableoid			26 0 0  4  -7 0 -1 -1 t p i t f f t 0 _null_));
  
+ /*
+  * pg_database and pg_index are not bootstrapped in the same way as as the
+  * other relations that have hardwired pg_attribute entries in this file.
+  * However, we do need "Schema_xxx" macro for them --- see relcache.c.  But
+  * since there are no DATA() statements for them in this file (or anywhere
+  * else), this can't be automatically generated, so we hard-code them here.
+  */
+ 
  /* ----------------
   *		pg_database
   * ----------------
   */
  #define Schema_pg_database \
*************** DATA(insert ( 1259 tableoid			26 0 0  4 
*** 490,499 ****
  
  /* ----------------
   *		pg_index
-  *
-  * pg_index is not bootstrapped in the same way as the other relations that
-  * have hardwired pg_attribute entries in this file.  However, we do need
-  * a "Schema_xxx" macro for it --- see relcache.c.
   * ----------------
   */
  #define Schema_pg_index \
--- 392,397 ----
