Skip site navigation (1) Skip section navigation (2)

Re: error handling

From: Oscar Rodriguez Fonseca <info(at)vraniscci(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: error handling
Date: 2006-04-27 15:28:08
Message-ID: 20060427172808.5d4dbe9b@vrlap.localvrnet (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
> --> I have a table with an UNIQUE constraint. Is it possible to have
> --> something like a trigger (or error handler) which is called every time
> --> a insert statement would break this constraint?  Or in some simple cases
> --> that this record is just dropped silently, without reporting an error?

> I believe that a UNIQUE constraint will stop the insert before any trigger 
> ever fires. Maybe someone else knows for sure.

I do not know if there is an specific error handler built in postgresql (besides error-codes).

If you break the unique constraint an error will be thrown. A
workaround may be to launch a trigger BEFORE the insertion and do whatever is necessary within the trigger.


In response to

pgsql-novice by date

Next:From: Christian HofmannDate: 2006-04-27 16:49:41
Subject: Getting the indexes of a table
Previous:From: Terry Lee TuckerDate: 2006-04-27 14:16:33
Subject: Re: error handling

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group