Re: Foreign keys

From: Chris Mair <chrisnospam(at)1006(dot)org>
To: MAR - Secretariado Geral <secretariadogeral(at)acra(dot)pt>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Foreign keys
Date: 2006-09-10 08:36:10
Message-ID: 1157877370.26364.11.camel@ultra.home.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers



> First of all i'de like to apolagize cause my poor english. After this,
> i shuould say that i beleavee a year ago i brought this problem to the
> community but i donn't remember some answering about it. The problem
> is:
>
> Every time a users misses a external refrenced key the PGSql raises an
> exception.
> Well as far as i realise if we had 5 or 10 Foreign keys
> during an Insert/Update transaction only exception should be raised
> reporting all erros/messages after last external refrenced field
> missed at one time,not one by one.
> Well, in order to implement this idea we will need to desable the
> built-in refencial integrety and build it all by your self- all the
> validation (look-ups etc..) before insert/update If tg_op='insert' or
> tg_op='update' then as people do with non relational Databases - all
> hand-made. Well, this is very hard to beleave!!! I must be missing
> something.
>
> Please i'must be wrong can some one explain me what i'm missing?

When there is a constraint violation, the current transaction is rolled
back anyhow.

What's the purpose of letting you insert 1000 records, then, at the end
say: "hah, all is rolled back becauase the 2nd record was invalid".
PG justly throws the exception immediately to let you know it's futile
inserting 998 more records.

I don't see a problem here.

Bye,
Chris.

--

Chris Mair
http://www.1006.org

In response to

  • Foreign keys at 2006-09-09 22:55:58 from MAR - Secretariado Geral

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2006-09-10 08:43:51 Re: Foreign keys
Previous Message Tom Lane 2006-09-10 00:58:54 Re: TODO item: GUID