Re: REFERENCES troubles - Mailing list pgsql-general

From JanWieck@t-online.de (Jan Wieck)
Subject Re: REFERENCES troubles
Date
Msg-id 200007042329.BAA04956@hot.jw.home
Whole thread Raw
In response to REFERENCES troubles  ("planx plnetx" <planetx2100@hotmail.com>)
List 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 by date:

Previous
From: Chris Bitmead
Date:
Subject: Re: Re: [HACKERS] Revised Copyright: is this more palatable?
Next
From: JanWieck@t-online.de (Jan Wieck)
Date:
Subject: Re: responses to licensing discussion