* Ken Tozier <[EMAIL PROTECTED]> [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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to