No, because the application first saves the coils and then saves the charge. Setting up the foreign key constraint would prevent any coils from being saved because the charge record would never exist at the time the coil record was created. RobR, who would love to hear some of the music in Galway Cathedral! -----Original Message----- From: Raymond O'Donnell [mailto:rod@xxxxxx] Sent: Friday, October 03, 2008 10:53 AM To: Rob Richardson Cc: pgsql-general@xxxxxxxxxxxxxx Subject: Re: [GENERAL] How do I save data and then raise an exception? On 03/10/2008 14:52, Rob Richardson wrote: > That's how it should have been done, but it wasn't. It's too late to > change it now. If I make any change to the C++ code, I run into a But setting up a foreign key constrain is something you do in the database, not in the app - can't you do that? Ray. ------------------------------------------------------------------ Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland rod@xxxxxx Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals ------------------------------------------------------------------