]> begriffs open source - ai-pg/blob - full-docs/html/bki-commands.html
Include latest toc output
[ai-pg] / full-docs / html / bki-commands.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>68.4. BKI Commands</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="bki-format.html" title="68.3. BKI File Format" /><link rel="next" href="bki-structure.html" title="68.5. Structure of the Bootstrap BKI File" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">68.4. <acronym class="acronym">BKI</acronym> Commands</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="bki-format.html" title="68.3. BKI File Format">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="bki.html" title="Chapter 68. System Catalog Declarations and Initial Contents">Up</a></td><th width="60%" align="center">Chapter 68. System Catalog Declarations and Initial Contents</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="bki-structure.html" title="68.5. Structure of the Bootstrap BKI File">Next</a></td></tr></table><hr /></div><div class="sect1" id="BKI-COMMANDS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">68.4. <acronym class="acronym">BKI</acronym> Commands <a href="#BKI-COMMANDS" class="id_link">#</a></h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
3      <code class="literal">create</code>
4      <em class="replaceable"><code>tablename</code></em>
5      <em class="replaceable"><code>tableoid</code></em>
6      [<span class="optional"><code class="literal">bootstrap</code></span>]
7      [<span class="optional"><code class="literal">shared_relation</code></span>]
8      [<span class="optional"><code class="literal">rowtype_oid</code> <em class="replaceable"><code>oid</code></em></span>]
9      (<em class="replaceable"><code>name1</code></em> =
10      <em class="replaceable"><code>type1</code></em>
11      [<span class="optional"><code class="literal">FORCE NOT NULL</code> | <code class="literal">FORCE NULL</code> </span>] [<span class="optional">,
12      <em class="replaceable"><code>name2</code></em> =
13      <em class="replaceable"><code>type2</code></em>
14      [<span class="optional"><code class="literal">FORCE NOT NULL</code> | <code class="literal">FORCE NULL</code> </span>],
15      ...</span>])
16     </span></dt><dd><p>
17       Create a table named <em class="replaceable"><code>tablename</code></em>, and having the OID
18       <em class="replaceable"><code>tableoid</code></em>,
19       with the columns given in parentheses.
20      </p><p>
21       The following column types are supported directly by
22       <code class="filename">bootstrap.c</code>: <code class="type">bool</code>,
23       <code class="type">bytea</code>, <code class="type">char</code> (1 byte),
24       <code class="type">name</code>, <code class="type">int2</code>,
25       <code class="type">int4</code>, <code class="type">regproc</code>, <code class="type">regclass</code>,
26       <code class="type">regtype</code>, <code class="type">text</code>,
27       <code class="type">oid</code>, <code class="type">tid</code>, <code class="type">xid</code>,
28       <code class="type">cid</code>, <code class="type">int2vector</code>, <code class="type">oidvector</code>,
29       <code class="type">_int4</code> (array), <code class="type">_text</code> (array),
30       <code class="type">_oid</code> (array), <code class="type">_char</code> (array),
31       <code class="type">_aclitem</code> (array).  Although it is possible to create
32       tables containing columns of other types, this cannot be done until
33       after <code class="structname">pg_type</code> has been created and filled with
34       appropriate entries.  (That effectively means that only these
35       column types can be used in bootstrap catalogs, but non-bootstrap
36       catalogs can contain any built-in type.)
37      </p><p>
38       When <code class="literal">bootstrap</code> is specified,
39       the table will only be created on disk; nothing is entered into
40       <code class="structname">pg_class</code>,
41       <code class="structname">pg_attribute</code>, etc., for it.  Thus the
42       table will not be accessible by ordinary SQL operations until
43       such entries are made the hard way (with <code class="literal">insert</code>
44       commands).  This option is used for creating
45       <code class="structname">pg_class</code> etc. themselves.
46      </p><p>
47       The table is created as shared if <code class="literal">shared_relation</code> is
48       specified.
49       The table's row type OID (<code class="structname">pg_type</code> OID) can optionally
50       be specified via the <code class="literal">rowtype_oid</code> clause; if not specified,
51       an OID is automatically generated for it.  (The <code class="literal">rowtype_oid</code>
52       clause is useless if <code class="literal">bootstrap</code> is specified, but it can be
53       provided anyway for documentation.)
54      </p></dd><dt><span class="term">
55      <code class="literal">open</code> <em class="replaceable"><code>tablename</code></em>
56     </span></dt><dd><p>
57       Open the table named
58       <em class="replaceable"><code>tablename</code></em>
59       for insertion of data.  Any currently open table is closed.
60      </p></dd><dt><span class="term">
61      <code class="literal">close</code> <em class="replaceable"><code>tablename</code></em>
62     </span></dt><dd><p>
63       Close the open table.  The name of the table must be given as a
64       cross-check.
65      </p></dd><dt><span class="term">
66      <code class="literal">insert</code> <code class="literal">(</code> [<span class="optional"><em class="replaceable"><code>oid_value</code></em></span>] <em class="replaceable"><code>value1</code></em> <em class="replaceable"><code>value2</code></em> ... <code class="literal">)</code>
67     </span></dt><dd><p>
68       Insert a new row into the open table using <em class="replaceable"><code>value1</code></em>, <em class="replaceable"><code>value2</code></em>, etc., for its column
69       values.
70      </p><p>
71       NULL values can be specified using the special key word
72       <code class="literal">_null_</code>.  Values that do not look like
73       identifiers or digit strings must be single-quoted.
74       (To include a single quote in a value, write it twice.
75       Escape-string-style backslash escapes are allowed in the string, too.)
76      </p></dd><dt><span class="term">
77      <code class="literal">declare</code> [<span class="optional"><code class="literal">unique</code></span>]
78      <code class="literal">index</code> <em class="replaceable"><code>indexname</code></em>
79      <em class="replaceable"><code>indexoid</code></em>
80      <code class="literal">on</code> <em class="replaceable"><code>tablename</code></em>
81      <code class="literal">using</code> <em class="replaceable"><code>amname</code></em>
82      <code class="literal">(</code> <em class="replaceable"><code>opclass1</code></em>
83      <em class="replaceable"><code>name1</code></em>
84      [<span class="optional">, ...</span>] <code class="literal">)</code>
85     </span></dt><dd><p>
86       Create an index named <em class="replaceable"><code>indexname</code></em>, having OID
87       <em class="replaceable"><code>indexoid</code></em>,
88       on the table named
89       <em class="replaceable"><code>tablename</code></em>, using the
90       <em class="replaceable"><code>amname</code></em> access
91       method.  The fields to index are called <em class="replaceable"><code>name1</code></em>, <em class="replaceable"><code>name2</code></em> etc., and the operator
92       classes to use are <em class="replaceable"><code>opclass1</code></em>, <em class="replaceable"><code>opclass2</code></em> etc., respectively.
93       The index file is created and appropriate catalog entries are
94       made for it, but the index contents are not initialized by this command.
95      </p></dd><dt><span class="term">
96      <code class="literal">declare toast</code>
97      <em class="replaceable"><code>toasttableoid</code></em>
98      <em class="replaceable"><code>toastindexoid</code></em>
99      <code class="literal">on</code> <em class="replaceable"><code>tablename</code></em>
100     </span></dt><dd><p>
101       Create a TOAST table for the table named
102       <em class="replaceable"><code>tablename</code></em>.
103       The TOAST table is assigned OID
104       <em class="replaceable"><code>toasttableoid</code></em>
105       and its index is assigned OID
106       <em class="replaceable"><code>toastindexoid</code></em>.
107       As with <code class="literal">declare index</code>, filling of the index
108       is postponed.
109      </p></dd><dt><span class="term"><code class="literal">build indices</code></span></dt><dd><p>
110       Fill in the indices that have previously been declared.
111      </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bki-format.html" title="68.3. BKI File Format">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bki.html" title="Chapter 68. System Catalog Declarations and Initial Contents">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bki-structure.html" title="68.5. Structure of the Bootstrap BKI File">Next</a></td></tr><tr><td width="40%" align="left" valign="top">68.3. <acronym class="acronym">BKI</acronym> File Format </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 68.5. Structure of the Bootstrap <acronym class="acronym">BKI</acronym> File</td></tr></table></div></body></html>