Re: [GENERAL] Right way to reject INSERTs and UPDATEs

2008-07-29 Thread hubert depesz lubaczewski
On Tue, Jul 29, 2008 at 02:25:21PM +0400, 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? of course. syntax: RAIS

Re: [GENERAL] Right way to reject INSERTs and UPDATEs

2008-07-29 Thread Richard Huxton
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

[GENERAL] Right way to reject INSERTs and UPDATEs

2008-07-29 Thread Dmitry Teslenko
Hello! I have postgresql table that stores dome date range: it has range-begin and range-end columns of type date. I want to enforce that 1) range-begin would always before range-end and 2) there would be no range overlaps. First problem could be solved with CHECK constraint. The only possibility