Re: REFERENCES troubles
От | JanWieck@t-online.de (Jan Wieck) |
---|---|
Тема | Re: REFERENCES troubles |
Дата | |
Msg-id | 200007042329.BAA04956@hot.jw.home обсуждение исходный текст |
Ответ на | REFERENCES troubles ("planx plnetx" <planetx2100@hotmail.com>) |
Список | pgsql-general |
planx plnetx wrote: > I get this error when creating a database: > > CREATE TABLE workers( > name varchar(30), > firstname varchar(30), > id_personal decimal(10)NOT NULL UNIQUE PRIMARY KEY, > ); > > CREATE TABLE payements( > date_of date, > owner REFERENCES workers(id_personal) > ); > > > IT gimme error!!! > why this isn't right? > the postgres documentation seem say to do in this manner... First thing incorrect is that you aren't creating a database, you are creating tables inside of an existing one. Second you just told us the statements that didn't work, but not what the database is yelling, nor which version of Postgres did so or the like. Forgiven :-) Third the comma after "PRIMARY KEY" in the "workers" table declaration is a syntax error. Forth you forgot to specify the data type of "owner" in the "payments" table. If I add "decimal(10)" before "REFERENCES" it works pretty good in 7.0.x. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
В списке pgsql-general по дате отправления: