Re: Newbie table definition question

Поиск
Список
Период
Сортировка
От Steven Klassen
Тема Re: Newbie table definition question
Дата
Msg-id 20041017030604.GA23312@commandprompt.com
обсуждение исходный текст
Ответ на Re: Newbie table definition question  (Ken Tozier <kentozier@comcast.net>)
Список pgsql-general
* Ken Tozier <kentozier@comcast.net> [2004-10-16 22:52:10 -0400]:

> Or is it one of those things that enforces data integrity behind the
> scenes?

That's exactly it -- one of the most attractive things about the
database is that if constraints are defined appropriately it can
defend itself from the programmer. ;)

xinu=> insert into grocery_items (grocery_types_id, name, price) values (100, 'Roast Beef', 5.50);
ERROR:  insert or update on table "grocery_items" violates foreign key constraint "grocery_types_id_exists"
DETAIL:  Key (grocery_types_id)=(100) is not present in table "grocery_types".

--
Steven Klassen - Lead Programmer
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Replication & Support Services, (503) 667-4564

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

Предыдущее
От: Mage
Дата:
Сообщение: dealing with invalid date
Следующее
От: Doug McNaught
Дата:
Сообщение: Re: dealing with invalid date