gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 line
9.5KB

  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>69.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 V1.79.1" /><link rel="prev" href="bki-format.html" title="69.3. BKI File Format" /><link rel="next" href="bki-structure.html" title="69.5. Structure of the Bootstrap BKI File" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">69.4. <acronym xmlns="http://www.w3.org/1999/xhtml" class="acronym">BKI</acronym> Commands</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="bki-format.html" title="69.3. BKI File Format">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="bki.html" title="Chapter 69. System Catalog Declarations and Initial Contents">Up</a></td><th width="60%" align="center">Chapter 69. System Catalog Declarations and Initial Contents</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="bki-structure.html" title="69.5. Structure of the Bootstrap BKI File">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="BKI-COMMANDS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">69.4. <acronym class="acronym">BKI</acronym> Commands</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 double quoted.
  74. </p></dd><dt><span class="term">
  75. <code class="literal">declare</code> [<span class="optional"><code class="literal">unique</code></span>]
  76. <code class="literal">index</code> <em class="replaceable"><code>indexname</code></em>
  77. <em class="replaceable"><code>indexoid</code></em>
  78. <code class="literal">on</code> <em class="replaceable"><code>tablename</code></em>
  79. <code class="literal">using</code> <em class="replaceable"><code>amname</code></em>
  80. <code class="literal">(</code> <em class="replaceable"><code>opclass1</code></em>
  81. <em class="replaceable"><code>name1</code></em>
  82. [<span class="optional">, ...</span>] <code class="literal">)</code>
  83. </span></dt><dd><p>
  84. Create an index named <em class="replaceable"><code>indexname</code></em>, having OID
  85. <em class="replaceable"><code>indexoid</code></em>,
  86. on the table named
  87. <em class="replaceable"><code>tablename</code></em>, using the
  88. <em class="replaceable"><code>amname</code></em> access
  89. 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
  90. classes to use are <em class="replaceable"><code>opclass1</code></em>, <em class="replaceable"><code>opclass2</code></em> etc., respectively.
  91. The index file is created and appropriate catalog entries are
  92. made for it, but the index contents are not initialized by this command.
  93. </p></dd><dt><span class="term">
  94. <code class="literal">declare toast</code>
  95. <em class="replaceable"><code>toasttableoid</code></em>
  96. <em class="replaceable"><code>toastindexoid</code></em>
  97. <code class="literal">on</code> <em class="replaceable"><code>tablename</code></em>
  98. </span></dt><dd><p>
  99. Create a TOAST table for the table named
  100. <em class="replaceable"><code>tablename</code></em>.
  101. The TOAST table is assigned OID
  102. <em class="replaceable"><code>toasttableoid</code></em>
  103. and its index is assigned OID
  104. <em class="replaceable"><code>toastindexoid</code></em>.
  105. As with <code class="literal">declare index</code>, filling of the index
  106. is postponed.
  107. </p></dd><dt><span class="term"><code class="literal">build indices</code></span></dt><dd><p>
  108. Fill in the indices that have previously been declared.
  109. </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">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bki.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bki-structure.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">69.3. <acronym class="acronym">BKI</acronym> File Format </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 69.5. Structure of the Bootstrap <acronym class="acronym">BKI</acronym> File</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1