On 4/6/18, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Just had another thought about this business: if practical, we should
> remove the distinction between "descr" and "shdescr" and just use the
> former name in .dat files.  genbki.pl knows which catalogs are shared,
> so it ought to be able to figure out where to route the descriptions.

Fairly trivial (attached), and shouldn't be too hard to integrate into
the series.

-John Naylor
diff --git a/src/backend/catalog/README.data b/src/backend/catalog/README.data
index 22ad0f2..2c05fab 100644
--- a/src/backend/catalog/README.data
+++ b/src/backend/catalog/README.data
@@ -22,7 +22,7 @@ modified exerpt from pg_database.dat will demonstrate the key features:
 # that might contain non-word characters, so we must double-quote them.
 
 { oid => '1', oid_symbol => 'TemplateDbOid',
-  shdescr => 'database\'s default template',
+  descr => 'database\'s default template',
   datname => 'template1', datdba => 'PGUID', encoding => 'ENCODING',
   datcollate => '"LC_COLLATE"', datctype => '"LC_CTYPE"', datistemplate => 't',
   datallowconn => 't', datconnlimit => '-1', datlastsysoid => '0',
@@ -33,8 +33,8 @@ modified exerpt from pg_database.dat will demonstrate the key features:
 
 -The overall file layout is: open bracket, one or more sets of curly
 brackets containing comma-separated key-value pairs, close bracket.
--The metadata fields oid, oid_symbol, descr, and shdescr come first on
-their own line(s) within the curly brackets.
+-The metadata fields oid, oid_symbol, and descr come first on their own
+line(s) within the curly brackets.
 -All values are single-quoted.
 -Single quotes within values must be escaped.
 -If a value is a macro to be expanded by initdb.c, it must also have
diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index 8d47109..bbe7da8 100644
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -400,13 +400,16 @@ EOM
 		# postgres.shdescription
 		if (defined $bki_values{descr})
 		{
-			printf $descr "%s\t%s\t0\t%s\n",
-			  $bki_values{oid}, $catname, $bki_values{descr};
-		}
-		if (defined $bki_values{shdescr})
-		{
-			printf $shdescr "%s\t%s\t%s\n",
-			  $bki_values{oid}, $catname, $bki_values{shdescr};
+			if ($catalog->{shared_relation})
+			{
+				printf $shdescr "%s\t%s\t%s\n",
+				  $bki_values{oid}, $catname, $bki_values{descr};
+			}
+			else
+			{
+				printf $descr "%s\t%s\t0\t%s\n",
+				  $bki_values{oid}, $catname, $bki_values{descr};
+			}
 		}
 
 		# Emit OID symbol
diff --git a/src/include/catalog/pg_database.dat b/src/include/catalog/pg_database.dat
index d5c2038..957ca84 100644
--- a/src/include/catalog/pg_database.dat
+++ b/src/include/catalog/pg_database.dat
@@ -16,7 +16,7 @@
 # that might contain non-word characters, so we must double-quote them.
 
 { oid => '1', oid_symbol => 'TemplateDbOid',
-  shdescr => 'default template for new databases',
+  descr => 'default template for new databases',
   datname => 'template1', datdba => 'PGUID', encoding => 'ENCODING',
   datcollate => '"LC_COLLATE"', datctype => '"LC_CTYPE"', datistemplate => 't',
   datallowconn => 't', datconnlimit => '-1', datlastsysoid => '0',
diff --git a/src/include/catalog/reformat_dat_file.pl b/src/include/catalog/reformat_dat_file.pl
index c247a72..f748a45 100644
--- a/src/include/catalog/reformat_dat_file.pl
+++ b/src/include/catalog/reformat_dat_file.pl
@@ -59,7 +59,7 @@ if ($output_path ne '' && substr($output_path, -1) ne '/')
 }
 
 # Metadata of a catalog entry
-my @METADATA = ('oid', 'oid_symbol', 'descr', 'shdescr');
+my @METADATA = ('oid', 'oid_symbol', 'descr');
 
 # Read all the input files into internal data structures.
 # We pass data file names as arguments and then look for matching

Reply via email to