1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>51.2.BKI Commands</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="bki.html" title="Chapter51.BKI Backend Interface">
<link rel="prev" href="bki.html" title="Chapter51.BKI Backend Interface">
<link rel="next" href="bki-structure.html" title="51.3.Structure of the Bootstrap BKI File">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="bki-commands"></a>51.2.<acronym class="acronym">BKI</acronym> Commands</h2></div></div></div>
<div class="variablelist"><dl>
<dt><span class="term"> <code class="literal">create</code>
[<span class="optional"><code class="literal">bootstrap</code></span>]
[<span class="optional"><code class="literal">shared_relation</code></span>]
[<span class="optional"><code class="literal">without_oids</code></span>]
<em class="replaceable"><code>tablename</code></em>
<em class="replaceable"><code>tableoid</code></em>
(<em class="replaceable"><code>name1</code></em> =
<em class="replaceable"><code>type1</code></em> [<span class="optional">,
<em class="replaceable"><code>name2</code></em> = <em class="replaceable"><code>type2</code></em>, ...</span>])
</span></dt>
<dd>
<p> Create a table named <em class="replaceable"><code>tablename</code></em>, and having the OID
<em class="replaceable"><code>tableoid</code></em>,
with the columns given in parentheses.
</p>
<p> The following column types are supported directly by
<code class="filename">bootstrap.c</code>: <code class="type">bool</code>,
<code class="type">bytea</code>, <code class="type">char</code> (1 byte),
<code class="type">name</code>, <code class="type">int2</code>,
<code class="type">int4</code>, <code class="type">regproc</code>, <code class="type">regclass</code>,
<code class="type">regtype</code>, <code class="type">text</code>,
<code class="type">oid</code>, <code class="type">tid</code>, <code class="type">xid</code>,
<code class="type">cid</code>, <code class="type">int2vector</code>, <code class="type">oidvector</code>,
<code class="type">_int4</code> (array), <code class="type">_text</code> (array),
<code class="type">_oid</code> (array), <code class="type">_char</code> (array),
<code class="type">_aclitem</code> (array). Although it is possible to create
tables containing columns of other types, this cannot be done until
after <code class="structname">pg_type</code> has been created and filled with
appropriate entries. (That effectively means that only these
column types can be used in bootstrapped tables, but non-bootstrap
catalogs can contain any built-in type.)
</p>
<p> When <code class="literal">bootstrap</code> is specified,
the table will only be created on disk; nothing is entered into
<code class="structname">pg_class</code>,
<code class="structname">pg_attribute</code>, etc, for it. Thus the
table will not be accessible by ordinary SQL operations until
such entries are made the hard way (with <code class="literal">insert</code>
commands). This option is used for creating
<code class="structname">pg_class</code> etc themselves.
</p>
<p> The table is created as shared if <code class="literal">shared_relation</code> is
specified.
It will have OIDs unless <code class="literal">without_oids</code> is specified.
</p>
</dd>
<dt><span class="term"> <code class="literal">open</code> <em class="replaceable"><code>tablename</code></em>
</span></dt>
<dd><p> Open the table named
<em class="replaceable"><code>tablename</code></em>
for insertion of data. Any currently open table is closed.
</p></dd>
<dt><span class="term"> <code class="literal">close</code> [<span class="optional"><em class="replaceable"><code>tablename</code></em></span>]
</span></dt>
<dd><p> Close the open table. The name of the table can be given as a
cross-check, but this is not required.
</p></dd>
<dt><span class="term"> <code class="literal">insert</code> [<span class="optional"><code class="literal">OID =</code> <em class="replaceable"><code>oid_value</code></em></span>] <code class="literal">(</code> <em class="replaceable"><code>value1</code></em> <em class="replaceable"><code>value2</code></em> ... <code class="literal">)</code>
</span></dt>
<dd>
<p> 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
values and <em class="replaceable"><code>oid_value</code></em> for its OID. If
<em class="replaceable"><code>oid_value</code></em> is zero
(0) or the clause is omitted, and the table has OIDs, then the
next available OID is assigned.
</p>
<p> NULL values can be specified using the special key word
<code class="literal">_null_</code>. Values containing spaces must be
double quoted.
</p>
</dd>
<dt><span class="term"> <code class="literal">declare</code> [<span class="optional"><code class="literal">unique</code></span>]
<code class="literal">index</code> <em class="replaceable"><code>indexname</code></em>
<em class="replaceable"><code>indexoid</code></em>
<code class="literal">on</code> <em class="replaceable"><code>tablename</code></em>
<code class="literal">using</code> <em class="replaceable"><code>amname</code></em>
<code class="literal">(</code> <em class="replaceable"><code>opclass1</code></em>
<em class="replaceable"><code>name1</code></em>
[<span class="optional">, ...</span>] <code class="literal">)</code>
</span></dt>
<dd><p> Create an index named <em class="replaceable"><code>indexname</code></em>, having OID
<em class="replaceable"><code>indexoid</code></em>,
on the table named
<em class="replaceable"><code>tablename</code></em>, using the
<em class="replaceable"><code>amname</code></em> access
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
classes to use are <em class="replaceable"><code>opclass1</code></em>, <em class="replaceable"><code>opclass2</code></em> etc., respectively.
The index file is created and appropriate catalog entries are
made for it, but the index contents are not initialized by this command.
</p></dd>
<dt><span class="term"><code class="literal">build indices</code></span></dt>
<dd><p> Fill in the indices that have previously been declared.
</p></dd>
</dl></div>
</div></body>
</html>
|