Thread: 7.1 docs -- "create table"?

7.1 docs -- "create table"?

From
will trillich
Date:
after upgrading from 7.0.3 to 7.1 i find some snags in the
indexing and 'references' --

ERROR:  UNIQUE constraint matching given keys for referenced table "d_language" not found

so i try going to /usr/share/doc/postgresql-doc/html/user
to find the 'create table' documentation...

where exactly is it? for 6.5.3 and 7.0.3 the docs had an
alphabetic listing under html/user -- where's it hiding now?

# (cd /usr/share/doc/postgresql-doc/html/user/ ; grep -ri 'create table' .)
./arrays.html:>CREATE TABLE sal_emp (
./arrays.html:>CREATE TABLE</B
./arrays.html:>CREATE TABLE tictactoe (
./bug-reporting.html:      preceding create table and insert statements, if the output should
./datatype-boolean.html:>CREATE TABLE test1 (a boolean, b text);
./datatype-bit.html:>CREATE TABLE test (a BIT(3), b BIT VARYING(5));
./datatype.html:>CREATE TABLE <TT
./datatype.html:CREATE TABLE <TT
./datatype.html:>CREATE TABLE <TT
./datatype.html:CREATE TABLE <TT
./indices-multicolumn.html:>CREATE TABLE test2 (
./indices.html:>CREATE TABLE test1 (
./inherit.html:>CREATE TABLE cities (
./inherit.html:CREATE TABLE capitals (
./typeconv-query.html:>tgl=> CREATE TABLE vv (v varchar(4));

i see discussion on arrays, bug reporting, datatypes, indexes,
inheritance and type conversion. nothing on the syntax for
creating indexes and constratins within the "create table"
statement. so where's "sql-create-table.html"?

--

the closest i can see to what i'm looking for is
$ psql somedb
> \h create table
Command:     CREATE TABLE
Description: Creates a new table
Syntax:
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 ]
}



--
I'd concentrate on "living in the now" because it is fun
and on building a better world because it is possible.
    - Tod Steward

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

Re: 7.1 docs -- "create table"?

From
Peter Eisentraut
Date:
will trillich writes:

> after upgrading from 7.0.3 to 7.1 i find some snags in the
> indexing and 'references' --
>
> ERROR:  UNIQUE constraint matching given keys for referenced table "d_language" not found

Every foreign key constraint needs to reference a unique (combination of)
columns.  7.0 didn't enforce this, but it never worked correctly without.

> so i try going to /usr/share/doc/postgresql-doc/html/user
> to find the 'create table' documentation...

Try something like ..../html/index.html and go to the Reference Manual.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter