September 26, 2024: PostgreSQL 17 Released!
Supported Versions: Current (17) / 16 / 15 / 14 / 13 / 12
Development Versions: devel
Unsupported versions: 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3 / 7.2 / 7.1
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

6.2. BKI Commands

open tablename

Open the table called tablename for further manipulation.

close [tablename]

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

create tablename (name1 = type1 [, name2 = type2, ...])

Create a table named tablename with the columns given in parentheses.

The type is not necessarily the data type that the column will have in the SQL environment; that is determined by the pg_attribute system catalog. The type here is essentially only used to allocate storage. The following types are allowed: bool, bytea, char (1 byte), name, int2, int2vector, int4, regproc, text, oid, tid, xid, cid, oidvector, smgr, _int4 (array), _aclitem (array). Array types can also be indicated by writing [] after the name of the element type.

Note: The table will only be created on disk, it will not automatically be registered in the system catalogs and will therefore not be accessible unless appropriate rows are inserted in pg_class, pg_attribute, etc.

insert [OID = oid_value] (value1 value2 ...)

Insert a new row into the open table using value1, value2, etc., for its column values and oid_value for its OID. If oid_value is zero (0) or the clause is omitted, then the next available OID is used.

NULL values can be specified using the special key word _null_. Values containing spaces must be double quoted.

declare [unique] index indexname on tablename using amname (opclass1 name1 [, ...])

Create an index named indexname on the table named tablename using the amname access method. The fields to index are called name1, name2 etc., and the operator classes to use are opclass1, opclass2 etc., respectively.

build indices

Build the indices that have previously been declared.