Skip to content

Commit 87669de

Browse files
committed
Some cleanup for change of collate and ctype fields to type text
Some cleanup for commit 5463750: 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.
1 parent cb2bab1 commit 87669de

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

doc/src/sgml/bki.sgml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,20 @@
175175
will demonstrate the key features:
176176
</para>
177177

178-
<programlisting>
178+
<!-- The "slight modification" is the apostrophe in the description. -->
179+
<programlisting><![CDATA[
179180
[
180181

181182
# A comment could appear here.
182-
{ oid =&gt; '1', oid_symbol =&gt; 'TemplateDbOid',
183-
descr =&gt; 'database\'s default template',
184-
datname =&gt; 'template1', encoding =&gt; 'ENCODING', datcollate =&gt; 'LC_COLLATE',
185-
datctype =&gt; 'LC_CTYPE', datistemplate =&gt; 't', datallowconn =&gt; 't',
186-
datconnlimit =&gt; '-1', datfrozenxid =&gt; '0',
187-
datminmxid =&gt; '1', dattablespace =&gt; 'pg_default', datacl =&gt; '_null_' },
183+
{ oid => '1', oid_symbol => 'TemplateDbOid',
184+
descr => 'database\'s default template',
185+
datname => 'template1', encoding => 'ENCODING', datistemplate => 't',
186+
datallowconn => 't', datconnlimit => '-1', datfrozenxid => '0',
187+
datminmxid => '1', dattablespace => 'pg_default', datcollate => 'LC_COLLATE',
188+
datctype => 'LC_CTYPE', datacl => '_null_' },
188189

189190
]
190-
</programlisting>
191+
]]></programlisting>
191192

192193
<para>
193194
Points to note:

src/backend/commands/dbcommands.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,14 +570,14 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
570570
DirectFunctionCall1(namein, CStringGetDatum(dbname));
571571
new_record[Anum_pg_database_datdba - 1] = ObjectIdGetDatum(datdba);
572572
new_record[Anum_pg_database_encoding - 1] = Int32GetDatum(encoding);
573-
new_record[Anum_pg_database_datcollate - 1] = CStringGetTextDatum(dbcollate);
574-
new_record[Anum_pg_database_datctype - 1] = CStringGetTextDatum(dbctype);
575573
new_record[Anum_pg_database_datistemplate - 1] = BoolGetDatum(dbistemplate);
576574
new_record[Anum_pg_database_datallowconn - 1] = BoolGetDatum(dballowconnections);
577575
new_record[Anum_pg_database_datconnlimit - 1] = Int32GetDatum(dbconnlimit);
578576
new_record[Anum_pg_database_datfrozenxid - 1] = TransactionIdGetDatum(src_frozenxid);
579577
new_record[Anum_pg_database_datminmxid - 1] = TransactionIdGetDatum(src_minmxid);
580578
new_record[Anum_pg_database_dattablespace - 1] = ObjectIdGetDatum(dst_deftablespace);
579+
new_record[Anum_pg_database_datcollate - 1] = CStringGetTextDatum(dbcollate);
580+
new_record[Anum_pg_database_datctype - 1] = CStringGetTextDatum(dbctype);
581581

582582
/*
583583
* We deliberately set datacl to default (NULL), rather than copying it

src/include/catalog/pg_database.dat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
{ oid => '1', oid_symbol => 'TemplateDbOid',
1616
descr => 'default template for new databases',
17-
datname => 'template1', encoding => 'ENCODING', datcollate => 'LC_COLLATE',
18-
datctype => 'LC_CTYPE', datistemplate => 't', datallowconn => 't',
19-
datconnlimit => '-1', datfrozenxid => '0',
20-
datminmxid => '1', dattablespace => 'pg_default', datacl => '_null_' },
17+
datname => 'template1', encoding => 'ENCODING', datistemplate => 't',
18+
datallowconn => 't', datconnlimit => '-1', datfrozenxid => '0',
19+
datminmxid => '1', dattablespace => 'pg_default', datcollate => 'LC_COLLATE',
20+
datctype => 'LC_CTYPE', datacl => '_null_' },
2121

2222
]

0 commit comments

Comments
 (0)