Hi,

What about changing the constraint:

CHECK (SELECT count(*) FROM calls, participants
    WHERE participants.id IN (from_participant_id, to_participant_id)
    and participants.call_id=call_id) > 0);

Regards,
Thomas



On Fri, Jun 7, 2013 at 3:38 PM, cowwoc <[email protected]> wrote:

> On 07/06/2013 5:03 AM, Noel Grandin wrote:
>
>>
>> On 2013-06-07 01:32, Gili wrote:
>>
>>>
>>> 2. When I insert into this table, it fails with the following
>>> stack-trace:
>>>
>>> 3. As you can see, the error message points to the INSERT statement but
>>> in fact the error is in the CHECK constraint.
>>> 4. Expected behavior: stack-trace should reference CHECK constraint, not
>>> INSERT statement.
>>>
>>>
>> How exactly would we distinguish between an error with the CHECK and an
>> error with the INSERT?
>>
>> We are executing the CHECK constraint when the INSERT occurs, and the
>> INSERT fails, so the error message points to the INSERT.
>>
>> If you can come up with some foolproof method of distinguishing between
>> - a failure of a CHECK constraint because the constraint is broken
>> vs
>> - a failure in the CHECK constraint because the INSERT was broken
>> then, sure, we can try to fix it.
>>
>> But I just don't see it.
>>
>> This is one of those cases where we give you lots of flexibility, and the
>> price you pay for the flexibility is that weird errors can happen.
>>
>>
> Hi Noel,
>
>     Before answering the question, could you please explain what "a
> failure in the CHECK constraint because the INSERT was broken" actually
> means? When/how would that occur?
>
> Thanks,
> Gili
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> h2-database+unsubscribe@**googlegroups.com<h2-database%[email protected]>
> .
> To post to this group, send email to [email protected].
> Visit this group at 
> http://groups.google.com/**group/h2-database?hl=en-US<http://groups.google.com/group/h2-database?hl=en-US>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to