/ db / test / sql /
/db/test/sql/followparts_replace_bio
1 -- Copyright (C) 2012 The Meme Factory, Inc., http://www.meme.com/
2 --
3 -- This file is part of Gombe-MI.
4 --
5 -- Gombe-MI is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with Gombe-MI. If not, see <http://www.gnu.org/licenses/>.
17 --
18 -- See that replacing the biography_data rows works when assocated with
19 -- an adoption and a follow invoving the adoption.
20 --
21 -- All data appearing in this work are fictitious. Any resemblance to
22 -- actual data, living or archived, is purely coincidental.
23 --
24 -- Karl O. Pinc <kop@meme.com>
25 --
26
27 -- Start a new transaction.
28 commit;
29 begin;
30
31 select 'Ensure that replacing an adopting parent in biography_data works when a follow involves the adoption' as message;
32
33 --
34 -- Main tables.
35 --
36
37 do $$
38
39 begin
40 create temp table foo
41 on commit drop
42 as select *
43 from biography_data
44 where biography_data.animid = 'MA3';
45
46 delete from biography_data
47 where biography_data.animid = 'MA3';
48
49 insert into biography_data
50 select * from foo;
51 end;
52 $$;