Re: create table - Mailing list pgsql-sql

From Tom Lane
Subject Re: create table
Date
Msg-id 1835.989016220@sss.pgh.pa.us
Whole thread Raw
In response to create table  (LeoDeBeo <leodebeo@hotmail.com>)
List pgsql-sql
LeoDeBeo <leodebeo@hotmail.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 ] [
ONUPDATE 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


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: [GENERAL] delete with cascade
Next
From: Joel Burton
Date:
Subject: Re: create table