Stuck on Foreign Keys

Поиск
Список
Период
Сортировка
От Chester
Тема Stuck on Foreign Keys
Дата
Msg-id 46F1F374.1070605@hica.com.au
обсуждение исходный текст
Ответы Re: Stuck on Foreign Keys  (Michael Glaesemann <grzm@seespotcode.net>)
Re: Stuck on Foreign Keys  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: Stuck on Foreign Keys  ("Phoenix Kiula" <phoenix.kiula@gmail.com>)
Re: Stuck on Foreign Keys  (Benjamin Smith <ben@schoolpathways.com>)
Список pgsql-general
Hi

I have a question regarding foreign keys, I just cannot get it to create
them for me....I must be doing something wrong but I have no idea what
that might be :)

I have a table "clients"

clientID (primary)
ticode
Firstname
SecondName

I have a second table "titles"

ticode (primary)
Title

I am trying to create a foreign key on TIcode "clients" table as in below,

ALTER TABLE clients ADD CONSTRAINT the_title FOREIGN KEY (ticode)
REFERENCES titles (ticode) ;

I keep getting this error

ERROR:  insert or update on table "clients" violates foreign key
constraint "the_title"
DETAIL:  Key (ticode)=( ) is not present in table "titles".

Sorry, I have no idea where I  am going wrong...Any help would be great

TIA

C

.





В списке pgsql-general по дате отправления:

Предыдущее
От: Benjamin Smith
Дата:
Сообщение: Postgresql and SSL
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Stuck on Foreign Keys