> Hi all
>
> In looking for how to do table constraints psql help says:
>
> software=> \h create table
> Command: create table
> Description: create a new table
> Syntax:
> CREATE TABLE class_name
> (attr1 type1 [DEFAULT expression] [NOT NULL], ...attrN)
> [INHERITS (class_name1, ...class_nameN)
> [[CONSTRAINT name] CHECK condition1, ...conditionN] ]
> ;
>
>
> But this both does not work, and does not agree with "The Practical SQL
> Handbook", the examples of which do work.
>
> Should the syntax not be more like: (constraint inside the main parens)
>
> Command: create table
> Description: create a new table
> Syntax:
> CREATE TABLE class_name
> (attr1 type1 [DEFAULT expression] [NOT NULL][, ...attrN]
> [,[CONSTRAINT name] CHECK condition1, ...conditionN] ]);
Fixed.
>
> I'm not sure where to put:
> [INHERITS (class_name1, ...class_nameN)
> as I've never used it. But I suspect it may need inside the '()' as well,
> no?
>
> OH, also, what is / is there, a comment character to use in SQL scripts
> feed into psql?
-- is the comment character. Man sql says:
---------------------------------------------------------------------------
Comments A comment is an arbitrary sequence of characters following double dashes up to the end of the line.
Wealso support double-slashes as comments, e.g.: -- This is a standard SQL comment // And this is
anothersupported comment style, like C++
We also support C-style comments, e.g.: /* multi line comment */
-- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026