Re: Newbie table definition question - Mailing list pgsql-general

From Steven Klassen
Subject Re: Newbie table definition question
Date
Msg-id 20041017030604.GA23312@commandprompt.com
Whole thread Raw
In response to Re: Newbie table definition question  (Ken Tozier <kentozier@comcast.net>)
List 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 by date:

Previous
From: Mage
Date:
Subject: dealing with invalid date
Next
From: Doug McNaught
Date:
Subject: Re: dealing with invalid date