At 00:22 21/11/00 -0500, Rod Taylor wrote:
>Christopher Kings-Lynne wrote:
>
>/*******************************
> * TABLE: example
> *
> * Used to accomplish stuff
> */
>CREATE TABLE example
> ( example_id serial
>
> /* Must be a ZIP or Postal Code */
> , region varchar(6) UNIQUE
> NOT NULL
>
> /* Descriptive text */
> , description varchar(60) NOT NULL
> );
>From the point of view of efficient dump & load, I think you actually need
to dump:
CREATE TABLE example
( example_id serial
-- Must be a ZIP or Postal Code
, region varchar(6)
-- Descriptive text
, description varchar(60)
);
Followed by:
ALTER TABLE example Alter Column region UNIQUE NOT NULL;
...etc. (Whatever the correct syntax is).
The reason for this is that UNIQUE constraints in particular are probably
very nasty things to check when loading a table. I would expect it to be
more efficient to create tables, load them, and define constraints. Also,
for FK constraints this is essential. Unless of course someone implements a
'SET ALL CONSTRAINTS OFF/ON'.
It is also nice to be able to dump constraints only.
So it's definitely a good idea to separate them, IMO.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.B.N. 75 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/