Re: create table with table constraints
От | Michael Fuhr |
---|---|
Тема | Re: create table with table constraints |
Дата | |
Msg-id | 20051215224915.GA46776@winnie.fuhr.org обсуждение исходный текст |
Ответ на | Re: create table with table constraints (Jim Beckstrom <jrbeckstrom@sbcglobal.net>) |
Список | pgsql-novice |
On Thu, Dec 15, 2005 at 02:21:29PM -0800, Jim Beckstrom wrote: > I looked at CREATE TABLE for both 8.0 and 7.2, they seem to be the > same. I reverted to CREATE INDEX [UNIQUE]..., and that still works. [snip 89-line example] It's easier to find problems if you reduce them to the smallest possible test case; the example you posted was bigger than it needed to be. Anyway, here's what's wrong: % psql -f test.sql psql:test.sql:89: ERROR: syntax error at or near "(" at character 6692 psql:test.sql:89: LINE 86: CONSTRAINT clientru (casenbr), psql:test.sql:89: ^ The offending lines are: > CONSTRAINT clientru (casenbr), > CONSTRAINT assgnther (assgnther, casenbr, th_ack_dat), > CONSTRAINT firstname (firstname), > CONSTRAINT program (program1, intakedate, ssnbr))"); You're trying to define several constraints but you've neglected to declare what kind of constraints they are. If you want them to be UNIQUE constraints then do what you did on the lines immediately preceding: > CONSTRAINT intakedt UNIQUE (intakedate, casenbr), > CONSTRAINT client_case UNIQUE (intakedate, casenbr), > CONSTRAINT clientss UNIQUE (intakedate, casenbr), > CONSTRAINT clientname UNIQUE (intakedate, casenbr), -- Michael Fuhr
В списке pgsql-novice по дате отправления: