Some cleanup for change of collate and ctype fields to type text
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 2 Feb 2022 10:58:55 +0000 (11:58 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 2 Feb 2022 10:58:55 +0000 (11:58 +0100)
Some cleanup for commit 54637508f87bd5f07fb9406bac6b08240283be3b:
Reformat pg_database.dat to reflect the new field order.  Also update
the corresponding example in bki.sgml.  Reorder the way the fields are
filled in dbcommands.c to correspond to the new order.

doc/src/sgml/bki.sgml
src/backend/commands/dbcommands.c
src/include/catalog/pg_database.dat

index ae32bfcb7e6a3d149429fb715a52d3d0c354a4d1..33955494c632ad8becc272c35402c4896f5b2b96 100644 (file)
     will demonstrate the key features:
    </para>
 
-<programlisting>
+<!-- The "slight modification" is the apostrophe in the description. -->
+<programlisting><![CDATA[
 [
 
 # A comment could appear here.
-{ oid =&gt; '1', oid_symbol =&gt; 'TemplateDbOid',
-  descr =&gt; 'database\'s default template',
-  datname =&gt; 'template1', encoding =&gt; 'ENCODING', datcollate =&gt; 'LC_COLLATE',
-  datctype =&gt; 'LC_CTYPE', datistemplate =&gt; 't', datallowconn =&gt; 't',
-  datconnlimit =&gt; '-1', datfrozenxid =&gt; '0',
-  datminmxid =&gt; '1', dattablespace =&gt; 'pg_default', datacl =&gt; '_null_' },
+{ oid => '1', oid_symbol => 'TemplateDbOid',
+  descr => 'database\'s default template',
+  datname => 'template1', encoding => 'ENCODING', datistemplate => 't',
+  datallowconn => 't', datconnlimit => '-1', datfrozenxid => '0',
+  datminmxid => '1', dattablespace => 'pg_default', datcollate => 'LC_COLLATE',
+  datctype => 'LC_CTYPE', datacl => '_null_' },
 
 ]
-</programlisting>
+]]></programlisting>
 
    <para>
     Points to note:
index 5a6c9beaa4765862280b8029521cd45daf448320..e673138cbdff1021ed61e9752ee7ced43da93a1c 100644 (file)
@@ -570,14 +570,14 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
        DirectFunctionCall1(namein, CStringGetDatum(dbname));
    new_record[Anum_pg_database_datdba - 1] = ObjectIdGetDatum(datdba);
    new_record[Anum_pg_database_encoding - 1] = Int32GetDatum(encoding);
-   new_record[Anum_pg_database_datcollate - 1] = CStringGetTextDatum(dbcollate);
-   new_record[Anum_pg_database_datctype - 1] = CStringGetTextDatum(dbctype);
    new_record[Anum_pg_database_datistemplate - 1] = BoolGetDatum(dbistemplate);
    new_record[Anum_pg_database_datallowconn - 1] = BoolGetDatum(dballowconnections);
    new_record[Anum_pg_database_datconnlimit - 1] = Int32GetDatum(dbconnlimit);
    new_record[Anum_pg_database_datfrozenxid - 1] = TransactionIdGetDatum(src_frozenxid);
    new_record[Anum_pg_database_datminmxid - 1] = TransactionIdGetDatum(src_minmxid);
    new_record[Anum_pg_database_dattablespace - 1] = ObjectIdGetDatum(dst_deftablespace);
+   new_record[Anum_pg_database_datcollate - 1] = CStringGetTextDatum(dbcollate);
+   new_record[Anum_pg_database_datctype - 1] = CStringGetTextDatum(dbctype);
 
    /*
     * We deliberately set datacl to default (NULL), rather than copying it
index d0b0c2d9a0e3aba1bb626fb44acbdfd5b240d9be..e7e42d60234b7d6e75b943c2d3bb28d9d2dd56d2 100644 (file)
@@ -14,9 +14,9 @@
 
 { oid => '1', oid_symbol => 'TemplateDbOid',
   descr => 'default template for new databases',
-  datname => 'template1', encoding => 'ENCODING', datcollate => 'LC_COLLATE',
-  datctype => 'LC_CTYPE', datistemplate => 't', datallowconn => 't',
-  datconnlimit => '-1', datfrozenxid => '0',
-  datminmxid => '1', dattablespace => 'pg_default', datacl => '_null_' },
+  datname => 'template1', encoding => 'ENCODING', datistemplate => 't',
+  datallowconn => 't', datconnlimit => '-1', datfrozenxid => '0',
+  datminmxid => '1', dattablespace => 'pg_default', datcollate => 'LC_COLLATE',
+  datctype => 'LC_CTYPE', datacl => '_null_' },
 
 ]