| From: | Steven Klassen <sklassen(at)commandprompt(dot)com> |
|---|---|
| To: | Ken Tozier <kentozier(at)comcast(dot)net> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Newbie table definition question |
| Date: | 2004-10-17 03:06:04 |
| Message-ID: | 20041017030604.GA23312@commandprompt.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
* Ken Tozier <kentozier(at)comcast(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Doug McNaught | 2004-10-17 03:26:43 | Re: dealing with invalid date |
| Previous Message | Mage | 2004-10-17 03:03:54 | dealing with invalid date |