1 .\" This is -*-nroff-*-
2 .\" XXX standard disclaimer belongs here....
3 .\" $Header: /cvsroot/pgsql/src/man/Attic/create_table.l,v 1.5 1997/08/26 17:39:30 momjian Exp $
4 .TH "CREATE TABLE" SQL 11/05/95 PostgreSQL PostgreSQL
6 create table \(em create a new class
9 \fBcreate table \fR classname \fB(\fPattname-1 type-1 {\fB,\fP attname-i type-i}\fB)\fP
10 [\fBinherits\fR \fB(\fR classname-1 {\fB,\fR classname-i} \fB)\fR]
11 [\fBarchive\fR \fB=\fR archive_mode]
12 [\fBstore\fR \fB=\fR \*(lqsmgr_name\*(rq]
13 [\fBarch_store\fR \fB=\fR \*(lqsmgr_name\*(rq]
17 will enter a new class into the current data base. The class will be
18 \*(lqowned\*(rq by the user issuing the command. The name of the
21 and the attributes are as specified in the list of
25 attribute is created with the type specified by
27 Each type may be a simple type, a complex type (set) or an array type.
29 Each array attribute stores arrays that must have the same number of
30 dimensions but may have different sizes and array index bounds. An
33 is specified by appending
35 pairs of square brackets:
42 clause specifies a collection of class names from which this class
43 automatically inherits all fields. If any inherited field name
44 appears more than once, Postgres reports an error. Postgres automatically
45 allows the created class to inherit functions on classes above it in
46 the inheritance hierarchy. Inheritance of functions is done according
47 to the conventions of the Common Lisp Object System (CLOS).
51 is automatically created as a type. Therefore, one or more instances
52 from the class are automatically a type and can be used in
58 for a further discussion of this point.
64 keywords may be used to specify a storage manager to use for the new
65 class. The released version of Postgres supports only \*(lqmagnetic
66 disk\*(rq as a storage manager name; the research system at UC Berkeley
67 provides additional storage managers.
69 controls the location of current data,
72 controls the location of historical data.
74 may only be specified if
76 is also specified. If either
80 is not declared, it defaults to \*(lqmagnetic disk\*(rq.
82 The new class is created as a heap with no initial data. A class can
83 have no more than 1600 attributes (realistically, this is limited by the
84 fact that tuple sizes must be less than 8192 bytes), but this limit
85 may be configured lower at some sites. A class cannot have the same
86 name as a system catalog class.
90 keyword specifies whether historical data is to be saved or discarded.
95 No historical access is supported.
98 Historical access is allowed and optimized for light update activity.
101 Historical access is allowed and optimized for heavy update activity.
104 defaults to \*(lqnone\*(rq. Once the archive status is set, there is
105 no way to change it. For details of the optimization, see [STON87].
109 -- Create class emp with attributes name, sal and bdate
111 create table emp (name char16, salary float4, bdate abstime)
115 --Create class permemp with pension information that
116 --inherits all fields of emp
118 create table permemp (plan char16) inherits (emp)
122 --Create class foo on magnetic disk and archive historical data
124 create table foo (bar int4) archive = heavy
125 store = "magnetic disk"
129 --Create class tictactoe to store noughts-and-crosses
130 --boards as a 2-dimensional array
132 create table tictactoe (game int4, board char[][])
136 --Create a class newemp with a set attribute "manager". A
137 --set (complex) attribute may be of the same type as the
138 --relation being defined (as here) or of a different complex
139 --type. The type must exist in the "pg_type" catalog or be
140 --the one currently being defined.
142 create table newemp (name text, manager newemp)