/ db / views /
/db/views/_error_immutable_view.m4
1 dnl Copyright (C) 2012 The Meme Factory, Inc. http://www.meme.com/
2 dnl Copyright (C) 2007, 2008, Karl O. Pinc <kop@meme.com>
3 dnl
4 dnl This file is part of Gombe-MI.
5 dnl
6 dnl Gombe-MI is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 3 of the License, or
9 dnl (at your option) any later version.
10 dnl
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with Gombe-MI. If not, see <http://www.gnu.org/licenses/>.
18 dnl
19 dnl Deliver an error message on an attempt to change a view.
20 dnl Karl O. Pinc <kop@meme.com>
21 dnl
22 dnl
23 dnl m4 includes
24 include(`copyright.m4')
25 include(`constants.m4')
26 include(`macros.m4')
27 dnl
28
29 SELECT '_error_immutable_view()';
30 CREATE OR REPLACE FUNCTION
31 _error_immutable_view()
32 RETURNS TRIGGER
33 LANGUAGE plpgsql
34 gmi_function_set_search_path
35 AS $$
36
37 -- Deliver an error message on an attempt to change a view.
38 --
39 -- GPL_notice(` --', `2007', `Karl O. Pinc <kop@meme.com>')
40 --
41 -- Syntax: _error_immutable_view()
42 --
43 -- Input:
44 --
45 -- Returns:
46 --
47 -- Side Effects:
48 -- Raises an exception.
49 --
50 -- Remarks:
51 -- Used when somebody tries to modify a view.
52
53
54 DECLARE
55
56 BEGIN
57 RAISE EXCEPTION '% is a (Gombe-MI) view which does not allow %'
58 , TG_RELNAME
59 , TG_OP;
60 RETURN NULL;
61 END;
62 $$;