Re: REFERENCES troubles

From: "planx plnetx" <planetx2100(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: REFERENCES troubles
Date: 2000-07-05 09:15:03
Message-ID: 20000705091503.80512.qmail@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>From: "Robert B. Easter" <reaster(at)comptechnews(dot)com>
>To: "planx plnetx" <planetx2100(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
>Subject: Re: [GENERAL] REFERENCES troubles
>Date: Tue, 4 Jul 2000 18:38:28 -0400
>
>On Tue, 04 Jul 2000, 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...
>
>You could try something like this instead:
>
>CREATE TABLE workers(
> id_personal SERIAL PRIMARY KEY,
> name VARCHAR(30),
> firstname VARCHAR(30)
>);
>CREATE TABLE payements(
> date_of DATE,
> owner REFERENCES workers
>);
>
>PRIMARY KEY implies UNIQUE NOT NULL
>SERIAL will be an INTEGER DEFAULT nextval('workers_id_personal_seq') so
>they
>get a number automatically.

Yes thanks, but why I can't specify a column like the manual say:
REFERENCES workers(id_personal)?

how the simple REFERENCES workers can get the primary key? maybe it is
automatiQUE????????
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2000-07-05 09:31:26 Re: [HACKERS] Re: Revised Copyright: is this morepalatable?
Previous Message Jan Wieck 2000-07-05 09:10:27 Re: [HACKERS] Re: Revised Copyright: is this more palatable??