WARNING

This text was automatically converted from troff me macros to HTML. Information may have been lost, added, or changed in the process. Lars Aronsson and Lysator do not guarantee the correctness of this HTML document.

NAME

&.../src/support/{local,dbdb}.bki *- template scripts

DESCRIPTION

Backend Interface (BKI) files are scripts that describe the contents of the initial POSTGRES database. This database is constructed during system installation, by the initdb command. Initdb executes the POSTGRES backend with a special set of flags, that cause it to consume the BKI scripts and bootstrap a database.

These files are automatically generated from system header files during installation. They are not intended for use by humans, and you do not need to understand their contents in order to use POSTGRES. These files are copied to .../files/local1.bki and .../files/global1.bki during system installation.

All new user databases will be created by copying the template database that POSTGRES constructs from the BKI files. Thus, a simple way to customize the template database is to let the POSTGRES initialization script create it for you, and then to run the terminal monitor to make the changes you want.

The POSTGRES backend interprets BKI files as described below. This description will be easier to understand if the example in .../files/global1.bki is at hand.

Commands are composed of a command name followed by space separated arguments. Arguments to a command which begin with a $ are treated specially. If $$ are the first two characters, then the first $ is ignored and the argument is then processed normally. If the $ is followed by space, then it is treated as a NULL value. Otherwise, the characters following the $ are interpreted as the name of a macro causing the argument to be replaced with the macro's value. It is an error for this macro to be undefined.

Macros are defined using "define macro macro_name = macro_value" and are undefined using "undefine macro macro_name" and redefined using the same syntax as define.

Lists of general commands and macro commands follow.

GENERAL COMMANDS

open classname

Open the class called classname for further manipulation.

close [classname]

Close the open class called classname. It is an error if classname is not already opened. If no classname is given, then the currently open class is closed.

print

Print the currently open class.

insert [ oid= oid_value ] '(' value1 value2 ...')'

Insert a new instance to the open class using value1, value2, etc. for its attribute values and oid_value for it's OID. If oid is not 0, then this value will be used as the instance's object identifier. Otherwise, it is an error. To let the system generate a unique object identifier (as opposed to the "well-known" object identifiers which we specify) use insert '(' value1, value2, ... valuen ')' .

create classname '(' name1 = type1, name2 = type2, ...name n = type n ')'

Create a class named classname with the attributes given in parentheses.

open '('name1 = type1, name2 = type2,...name n = type n ')' as classname

Open a class named classname for writing but do not record its existence in the system catalogs. (This is primarily to aid in bootstrapping.)

destroy classname

Destroy the class named classname.

define index <index-name> on <class-name> using <amname> ( <opclass> <attr> | function({attr}) )

Create an index named index_name on the class named classname using the amname access method. The fields to index are called name1, name2, etc. and the operator collections to use are collection_1, collection_2, etc., respectively.

MACRO COMMANDS

define function macro_name as rettype function_name ( args )

Define a function prototype for a function named macro_name which has its value of type rettype computed from the execution function_name with the arguments args declared in a C-like manner etc.

define macro macro_name from file filename

Define a macro named macname which has its value read from the file called filename.

EXAMPLE

The following set of commands will create the OPCLASS class containing the int_ops collection as object 421, print out the class, and then close it.

create pg_opclass (opcname=char16) open pg_opclass insert oid=421 (int_ops) print close pg_opclass

SEE ALSO

initdb(unix), createdb(unix), createdb(commands), template(files).