Received: from bugs.unl.edu.ar (bugs.unl.edu.ar [168.96.132.208]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f44MGPA79872 for ; Fri, 4 May 2001 18:16:25 -0400 (EDT) (envelope-from martin@bugs.unl.edu.ar) Received: by bugs.unl.edu.ar (Postfix, from userid 1004) id 599B52AB23; Fri, 4 May 2001 19:17:03 +0300 (GMT) Content-Type: text/plain; charset="iso-8859-1" From: =?iso-8859-1?q?Mart=EDn=20Marqu=E9s?= To: LeoDeBeo , pgsql-sql@postgresql.org Subject: Re: create table Date: Fri, 4 May 2001 19:17:02 +0300 X-Mailer: KMail [version 1.2] References: <9chqd9$21vm$2@news.tht.net> In-Reply-To: <9chqd9$21vm$2@news.tht.net> MIME-Version: 1.0 Message-Id: <01050419170205.07818@bugs> Content-Transfer-Encoding: 8bit X-Archive-Number: 200105/29 X-Sequence-Number: 2831 On Dom 29 Abr 2001 22:34, LeoDeBeo wrote: > can anybody explain me the syntax of Create Table documentation?? > > CREATE [ TEMPORARY | TEMP ] TABLE table ( > column type > [ NULL | NOT NULL ] [ UNIQUE ] [ DEFAULT value ] > [ column_constraint_clause | PRIMARY KEY } [ ... ] ] > [ , ... ] > [ , PRIMARY KEY ( column [, ... ] ) ] > [ , CHECK (condition) ] > [ , table_constraint_clause ] > ) [ INHERITS ( inherited_table [, ... ] ) ] > > i don't understand what the curly brace means after PRIMARY KEY (where is > the other matching brace? ). It must have something to do with the fact > that a 'column type' pair ( with options ) can occur more than once, but is > this syntax right? > i also don't understand what the [ ... ] and [, ... ] means. I do know that > brackets denote options and | alternatives. My docs (7.1) look like this: 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 ] } Looks clear to me. :-) -- El mejor sistema operativo es aquel que te da de comer. Cuida tu dieta. ----------------------------------------------------------------- Martin Marques | mmarques@unl.edu.ar Programador, Administrador | Centro de Telematica Universidad Nacional del Litoral -----------------------------------------------------------------