2 x duplicate key value violation: which exception comes first ?

From: "Marc Mamin" <M(dot)Mamin(at)intershop(dot)de>
To: <pgsql-general(at)postgresql(dot)org>
Subject: 2 x duplicate key value violation: which exception comes first ?
Date: 2012-03-01 13:41:58
Message-ID: C4DAC901169B624F933534A26ED7DF310861B40D@JENMAIL01.ad.intershop.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I've a table with 1 primary key and 1 unique index.

I would like to handle differently the duplicate key violations
depending on which constraints are affected.
(Within a plpgsql CATCH block, using SQLERRM).

It seems, that when both constraints would be violated, the exception is
always about the primary key.

Can I rely on that or should I expect the exception order being random ?

Thanks,

Marc Mamin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris McCormick 2012-03-01 13:52:09 Re: Problem with initdb and two versions on one server?
Previous Message François Beausoleil 2012-03-01 13:24:21 Allowed DML on replicas?