comparison schema/auth_tests.sql @ 1983:f9f1babe52ae

Fix area generation from multipolygon input In case the waterway axis representing a stretch intersects distinct parts of the input area, a multipolygon has to be returned. Before, an arbitrary polygon was selected due to the used function not being set-returning. In passing, consistently name respective columns in schema.
author Tom Gottfried <tom@intevation.de>
date Wed, 23 Jan 2019 16:25:43 +0100
parents 931b15be6d7f
children 59055c8301df
comparison
equal deleted inserted replaced
1982:a7e47a9d890b 1983:f9f1babe52ae
50 -- 50 --
51 -- Run tests as waterway administrator 51 -- Run tests as waterway administrator
52 -- 52 --
53 SET SESSION AUTHORIZATION test_admin_at; 53 SET SESSION AUTHORIZATION test_admin_at;
54 54
55 PREPARE bn_insert (varchar, geometry(POLYGON, 4326)) AS 55 PREPARE bn_insert (varchar, geometry(MULTIPOLYGON, 4326)) AS
56 INSERT INTO waterway.bottlenecks ( 56 INSERT INTO waterway.bottlenecks (
57 bottleneck_id, fk_g_fid, stretch, area, rb, lb, responsible_country, 57 bottleneck_id, fk_g_fid, stretch, area, rb, lb, responsible_country,
58 revisiting_time, limiting, source_organization) 58 revisiting_time, limiting, source_organization)
59 VALUES ( 59 VALUES (
60 $1, 60 $1,
65 1, 'depth', 'testorganization' 65 1, 'depth', 'testorganization'
66 ); 66 );
67 SELECT lives_ok($$ 67 SELECT lives_ok($$
68 EXECUTE bn_insert( 68 EXECUTE bn_insert(
69 'test1', 69 'test1',
70 ST_geomfromtext('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))', 4326)) 70 ST_geomfromtext('MULTIPOLYGON(((0 0, 0 1, 1 1, 1 0, 0 0)))', 4326))
71 $$, 71 $$,
72 'Waterway admin can insert data within his region'); 72 'Waterway admin can insert data within his region');
73 SELECT throws_ok($$ 73 SELECT throws_ok($$
74 EXECUTE bn_insert( 74 EXECUTE bn_insert(
75 'test2', 75 'test2',
76 ST_geomfromtext('POLYGON((1 0, 1 1, 2 1, 2 0, 1 0))', 4326)) 76 ST_geomfromtext('MULTIPOLYGON(((1 0, 1 1, 2 1, 2 0, 1 0)))', 4326))
77 $$, 77 $$,
78 42501, NULL, 78 42501, NULL,
79 'Waterway admin cannot insert data outside his region'); 79 'Waterway admin cannot insert data outside his region');
80 80
81 -- template management 81 -- template management