-- Copyright (C) 2012 The Meme Factory, Inc., http://www.meme.com/ -- -- This file is part of Gombe-MI. -- -- Gombe-MI is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Gombe-MI. If not, see . -- -- SQL to test the intervals table integrity constraints. -- Raise an error because sheets are left without related intervals. -- Test the intervals trigger. -- -- All data appearing in this work are fictitious. Any resemblance to -- actual data, living or archived, is purely coincidental. -- -- Karl O. Pinc -- -- Because intervals delete sheets on commit we must commit additions -- or else we get a race condition on whether the intervals delete commit -- trigger fires first or the sheets insert commit trigger. commit; begin; delete from intervals where sheetid = 2; -- Then delete the follow so we don't get a follow without intervals. delete from follows where followid = 2; commit; begin; -- See that the delete trigger did it's job. select count(*) from sheets where sheetid = 2;