|
| 1 | +.\" This is -*-nroff-*- |
| 2 | +.\" $Header: /cvsroot/pgsql/src/man/Attic/bki.5,v 1.1 1996/11/14 10:15:12 scrappy Exp $ |
| 3 | +.TH BKI 5 11/04/96 Postgres Postgres |
| 4 | +.SH NAME |
| 5 | +*.bki |
| 6 | +.SH DESCRIPTION |
| 7 | +Backend Interface (BKI) files are scripts that are input to the postgres |
| 8 | +backend running in the special "bootstrap" mode that allows it to perform |
| 9 | +database functions without a database system already existing. BKI files |
| 10 | +can therefore be used to create the database system in the first place. |
| 11 | +.PP |
| 12 | +.IR Initdb |
| 13 | +uses BKI files to do just that -- create a database system. However, |
| 14 | +.IR initdb's |
| 15 | +BKI files are generated internally. It generates them using the files |
| 16 | +global1.bki.source and local1.template1.bki.source, which it finds in the |
| 17 | +Postgres "library" directory. They get installed there as part of installing |
| 18 | +Postgres. These .source files get build as part of the Postgres build |
| 19 | +process, by a build program called |
| 20 | +.IR genbki. Genbki |
| 21 | +takes as input Postgres source files that double as |
| 22 | +.IR genbki |
| 23 | +input that builds tables and C header files that describe those |
| 24 | +tables. |
| 25 | +.PP |
| 26 | +The Postgres backend interprets BKI files as described below. This |
| 27 | +description will be easier to understand if the global1.bki.source file is |
| 28 | +at hand as an example. (As explained above, this .source file isn't quite |
| 29 | +a BKI file, but you'll be able to guess what the resulting BKI file would be |
| 30 | +anyway). |
| 31 | +.PP |
| 32 | +Commands are composed of a command name followed by space separated |
| 33 | +arguments. Arguments to a command which begin with a \*(lq$\*(rq are |
| 34 | +treated specially. If \*(lq$$\*(rq are the first two characters, then |
| 35 | +the first \*(lq$\*(rq is ignored and the argument is then processed |
| 36 | +normally. If the \*(lq$\*(rq is followed by space, then it is treated |
| 37 | +as a |
| 38 | +.SM NULL |
| 39 | +value. Otherwise, the characters following the \*(lq$\*(rq are |
| 40 | +interpreted as the name of a macro causing the argument to be replaced |
| 41 | +with the macro's value. It is an error for this macro to be |
| 42 | +undefined. |
| 43 | +.PP |
| 44 | +Macros are defined using |
| 45 | +.nf |
| 46 | +define macro macro_name = macro_value |
| 47 | +.fi |
| 48 | +and are undefined using |
| 49 | +.nf |
| 50 | +undefine macro macro_name |
| 51 | +.fi |
| 52 | +and redefined using the same syntax as define. |
| 53 | +.PP |
| 54 | +Lists of general commands and macro commands |
| 55 | +follow. |
| 56 | +.SH "GENERAL COMMANDS" |
| 57 | +.TP 5n |
| 58 | +.BR "open" " classname" |
| 59 | +Open the class called |
| 60 | +.IR classname |
| 61 | +for further manipulation. |
| 62 | +.TP |
| 63 | +.BR "close" " [classname]" |
| 64 | +Close the open class called |
| 65 | +.IR classname. |
| 66 | +It is an error if |
| 67 | +.IR classname |
| 68 | +is not already opened. If no |
| 69 | +.IR classname |
| 70 | +is given, then the currently open class is closed. |
| 71 | +.TP |
| 72 | +.BR print |
| 73 | +Print the currently open class. |
| 74 | +.TP |
| 75 | +.BR "insert" " [oid=oid_value] " "(" " value1 value2 ... " ")" |
| 76 | +Insert a new instance to the open class using |
| 77 | +.IR value1 , |
| 78 | +.IR value2 , |
| 79 | +etc., for its attribute values and |
| 80 | +.IR oid_value |
| 81 | +for its OID. If |
| 82 | +.IR oid_value |
| 83 | +is not \*(lq0\*(rq, then this value will be used as the instance's |
| 84 | +object identifier. Otherwise, it is an error. |
| 85 | +.TP |
| 86 | +.BR "insert (" " value1 value2 ... " ")" |
| 87 | +As above, but the system generates a unique object identifier. |
| 88 | +.TP |
| 89 | +.BR "create" " classname " "(" " name1 = type1, name2 = type2, ... " ")" |
| 90 | +Create a class named |
| 91 | +.IR classname |
| 92 | +with the attributes given in parentheses. |
| 93 | +.TP |
| 94 | +.BR "open (" " name1 = type1, name2 = type2,... " ") as" " classname" |
| 95 | +Open a class named |
| 96 | +.IR classname |
| 97 | +for writing but do not record its existence in the system catalogs. |
| 98 | +(This is primarily to aid in bootstrapping.) |
| 99 | +.TP |
| 100 | +.BR "destroy" " classname" |
| 101 | +Destroy the class named |
| 102 | +.IR classname . |
| 103 | +.TP |
| 104 | +.BR "define index" " index-name " "on" " class-name " "using" " amname " |
| 105 | +( opclass attr | function({attr}) ) |
| 106 | +.br |
| 107 | +Create an index named |
| 108 | +.IR index_name |
| 109 | +on the class named |
| 110 | +.IR classname |
| 111 | +using the |
| 112 | +.IR amname |
| 113 | +access method. The fields to index are called |
| 114 | +.IR name1 , |
| 115 | +.IR name2 , |
| 116 | +etc., and the operator collections to use are |
| 117 | +.IR collection_1 , |
| 118 | +.IR collection_2 , |
| 119 | +etc., respectively. |
| 120 | +.SH "MACRO COMMANDS" |
| 121 | +.TP |
| 122 | +.BR "define function" " macro_name " "as" " rettype function_name ( args )" |
| 123 | +Define a function prototype for a function named |
| 124 | +.IR macro_name |
| 125 | +which has its value of type |
| 126 | +.IR rettype |
| 127 | +computed from the execution |
| 128 | +.IR function_name |
| 129 | +with the arguments |
| 130 | +.IR args |
| 131 | +declared in a C-like manner. |
| 132 | +.TP |
| 133 | +.BR "define macro" " macro_name " "from file" " filename" |
| 134 | +Define a macro named |
| 135 | +.IR macname |
| 136 | +which has its value |
| 137 | +read from the file called |
| 138 | +.IR filename . |
| 139 | +.\" .uh "DEBUGGING COMMANDS" |
| 140 | +.\" .sp |
| 141 | +.\" .in .5i |
| 142 | +.\" r |
| 143 | +.\" .br |
| 144 | +.\" Randomly print the open class. |
| 145 | +.\" .sp |
| 146 | +.\" m -1 |
| 147 | +.\" .br |
| 148 | +.\" Toggle display of time information. |
| 149 | +.\" .sp |
| 150 | +.\" m 0 |
| 151 | +.\" .br |
| 152 | +.\" Set retrievals to now. |
| 153 | +.\" .sp |
| 154 | +.\" m 1 Jan 1 01:00:00 1988 |
| 155 | +.\" .br |
| 156 | +.\" Set retrievals to snapshots of the specfied time. |
| 157 | +.\" .sp |
| 158 | +.\" m 2 Jan 1 01:00:00 1988, Feb 1 01:00:00 1988 |
| 159 | +.\" .br |
| 160 | +.\" Set retrievals to ranges of the specified times. |
| 161 | +.\" Either time may be replaced with space |
| 162 | +.\" if an unbounded time range is desired. |
| 163 | +.\" .sp |
| 164 | +.\" \&.A classname natts name1 type1 name2 type2 ... |
| 165 | +.\" .br |
| 166 | +.\" Add attributes named |
| 167 | +.\" .ul |
| 168 | +.\" name1, |
| 169 | +.\" .ul |
| 170 | +.\" name2, |
| 171 | +.\" etc. of |
| 172 | +.\" types |
| 173 | +.\" .ul |
| 174 | +.\" type1, |
| 175 | +.\" .ul |
| 176 | +.\" type2, |
| 177 | +.\" etc. to the |
| 178 | +.\" .ul |
| 179 | +.\" class |
| 180 | +.\" classname. |
| 181 | +.\" .sp |
| 182 | +.\" \&.RR oldclassname newclassname |
| 183 | +.\" .br |
| 184 | +.\" Rename the |
| 185 | +.\" .ul |
| 186 | +.\" oldclassname |
| 187 | +.\" class to |
| 188 | +.\" .ul |
| 189 | +.\" newclassname. |
| 190 | +.\" .sp |
| 191 | +.\" \&.RA classname oldattname newattname |
| 192 | +.\" .br |
| 193 | +.\" Rename the |
| 194 | +.\" .ul |
| 195 | +.\" oldattname |
| 196 | +.\" attribute in the class named |
| 197 | +.\" .ul |
| 198 | +.\" classname |
| 199 | +.\" to |
| 200 | +.\" .ul |
| 201 | +.\" newattname. |
| 202 | +.SH EXAMPLE |
| 203 | +The following set of commands will create the \*(lqpg_opclass\*(rq |
| 204 | +class containing the |
| 205 | +.IR int_ops |
| 206 | +collection as object |
| 207 | +.IR 421, |
| 208 | +print out the class, and then close it. |
| 209 | +.nf |
| 210 | +create pg_opclass (opcname=char16) |
| 211 | +open pg_opclass |
| 212 | +insert oid=421 (int_ops) |
| 213 | +print |
| 214 | +close pg_opclass |
| 215 | +.fi |
| 216 | +.SH "SEE ALSO" |
| 217 | +initdb(1), |
| 218 | +createdb(1), |
| 219 | +create_database(l). |
0 commit comments