Re: create table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: LeoDeBeo <leodebeo(at)hotmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: create table
Date: 2001-05-04 22:43:40
Message-ID: 1835.989016220@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

LeoDeBeo <leodebeo(at)hotmail(dot)com> writes:
> i don't understand what the curly brace means after PRIMARY KEY (where is
> the other matching brace?

Typo. Try more recent versions of the docs. 7.1 says

CREATE [ TEMPORARY | TEMP ] TABLE table_name (
{ column_name type [ column_constraint [ ... ] ]
| table_constraint } [, ... ]
) [ INHERITS ( inherited_table [, ... ] ) ]

where column_constraint can be:
[ CONSTRAINT constraint_name ]
{ NOT NULL | NULL | UNIQUE | PRIMARY KEY | DEFAULT value | CHECK (condition) |
REFERENCES table [ ( column ) ] [ MATCH FULL | MATCH PARTIAL ]
[ ON DELETE action ] [ ON UPDATE action ]
[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
}

and table_constraint can be:
[ CONSTRAINT constraint_name ]
{ UNIQUE ( column_name [, ... ] ) |
PRIMARY KEY ( column_name [, ... ] ) |
CHECK ( condition ) |
FOREIGN KEY ( column_name [, ... ] ) REFERENCES table [ ( column [, ... ] ) ]
[ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ]
[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
}

The curly braces are just for grouping in cases where it'd not be clear
how far the alternatives are supposed to extend.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Sawtell 2001-05-05 06:58:50 Re: '13 months ago'::reltime
Previous Message Tom Lane 2001-05-04 22:24:09 Re: [SQL] delete with cascade