class="parameter">toasttableoid</replaceable>
and its index is assigned OID
<replaceable class="parameter">toastindexoid</replaceable>.
As with <literal>declare index</literal>, filling of the index
is postponed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>build indices</literal></term>
<listitem>
<para>
Fill in the indices that have previously been declared.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect1>
<sect1 id="bki-structure">
<title>Structure of the Bootstrap <acronym>BKI</acronym> File</title>
<para>
The <literal>open</literal> command cannot be used until the tables it uses
exist and have entries for the table that is to be opened.
(These minimum tables are <structname>pg_class</structname>,
<structname>pg_attribute</structname>, <structname>pg_proc</structname>, and
<structname>pg_type</structname>.) To allow those tables themselves to be filled,
<literal>create</literal> with the <literal>bootstrap</literal> option implicitly opens
the created table for data insertion.
</para>
<para>
Also, the <literal>declare index</literal> and <literal>declare toast</literal>
commands cannot be used until the system catalogs they need have been
created and filled in.
</para>
<para>
Thus, the structure of the <filename>postgres.bki</filename> file has to
be:
<orderedlist>
<listitem>
<para>
<literal>create bootstrap</literal> one of the critical tables
</para>
</listitem>
<listitem>
<para>
<literal>insert</literal> data describing at least the critical tables
</para>
</listitem>
<listitem>
<para>
<literal>close</literal>
</para>
</listitem>
<listitem>
<para>
Repeat for the other critical tables.
</para>
</listitem>
<listitem>
<para>
<literal>create</literal> (without <literal>bootstrap</literal>) a noncritical table
</para>
</listitem>
<listitem>
<para>
<literal>open</literal>
</para>
</listitem>
<listitem>
<para>
<literal>insert</literal> desired data
</para>
</listitem>
<listitem>
<para>
<literal>close</literal>
</para>
</listitem>
<listitem>
<para>
Repeat for the other noncritical tables.
</para>
</listitem>
<listitem>
<para>
Define indexes and toast tables.
</para>
</listitem>
<listitem>
<para>
<literal>build indices</literal>
</para>
</listitem>
</orderedlist>
</para>
<para>
There are doubtless other, undocumented ordering dependencies.
</para>
</sect1>
<sect1 id="bki-example">
<title>BKI Example</title>
<para>
The following sequence of commands will create the table
<literal>test_table</literal> with OID 420, having three columns
<literal>oid</literal>, <literal>cola</literal> and <literal>colb</literal>
of type <type>oid</type>, <type>int4</type> and <type>text</type>,
respectively, and insert two rows into the table:
<programlisting>
create test_table 420 (oid = oid, cola = int4, colb = text)
open test_table
insert ( 421 1 'value 1' )
insert ( 422 2 _null_ )
close test_table
</programlisting>
</para>
</sect1>
</chapter>