Re: Right way to reject INSERTs and UPDATEs - Mailing list pgsql-general

From Richard Huxton
Subject Re: Right way to reject INSERTs and UPDATEs
Date
Msg-id 488EF1DF.4030804@archonet.com
Whole thread Raw
In response to Right way to reject INSERTs and UPDATEs  ("Dmitry Teslenko" <dteslenko@gmail.com>)
List pgsql-general
Dmitry Teslenko wrote:
> These solution work and enforce data integrity as needed. Sadly, database
> interface I use (Trolltech Qt 3) can't track when trigger aborts
> update or insert. Can I raise exception in trigger or something?

RAISE EXCEPTION 'Failed to update mytable: date range (%,%) overlaps an
existing entry', NEW.from_dt, NEW.to_dt;

You can also do RAISE NOTICE, WARNING etc. See the pl/pgsql section of
the manual for details.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: valgog
Date:
Subject: Re: array_accum() and quoted content
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: Right way to reject INSERTs and UPDATEs