Skip to content

Commit 34f7b04

Browse files
committed
(sampledata/pgtap) use of pgr_findCloseEdges depends on version
1 parent 222db36 commit 34f7b04

File tree

5 files changed

+38
-11
lines changed

5 files changed

+38
-11
lines changed

doc/src/sampledata.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ reached from both sides.
241241
The points of interest:
242242

243243
.. literalinclude:: sampledata.queries
244-
:start-after: -- p5
245-
:end-before: -- p6
244+
:start-after: -- p6
245+
:end-before: -- p7
246246

247247
.. pois_end
248248

docqueries/src/sampledata.result

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ FROM edges ORDER BY id;
150150

151151
/* -- q5 */
152152
/* --POINTS CREATE start */
153+
DO LANGUAGE plpgsql $BODY$
154+
DECLARE v FLOAT;
155+
BEGIN
156+
SELECT (parts[1]||'.'||parts[2])::FLOAT FROM STRING_TO_ARRAY(pgr_version(), '.') AS parts INTO v;
153157
/* -- p1 */
154158
CREATE TABLE pointsOfInterest(
155159
pid BIGSERIAL PRIMARY KEY,
@@ -160,7 +164,7 @@ CREATE TABLE pointsOfInterest(
160164
edge geometry,
161165
newPoint geometry,
162166
geom geometry);
163-
CREATE TABLE
167+
IF v > 3.4 THEN
164168
/* -- p2 */
165169
INSERT INTO pointsOfInterest (geom) VALUES
166170
(ST_Point(1.8, 0.4)),
@@ -169,7 +173,6 @@ INSERT INTO pointsOfInterest (geom) VALUES
169173
(ST_Point(0.3, 1.8)),
170174
(ST_Point(2.9, 1.8)),
171175
(ST_Point(2.2, 1.7));
172-
INSERT 0 6
173176
/* -- p3 */
174177
UPDATE pointsofinterest SET
175178
edge_id = poi.edge_id,
@@ -183,11 +186,21 @@ FROM (
183186
FROM pgr_findCloseEdges(
184187
$$SELECT id, geom FROM edges$$,(SELECT array_agg(geom) FROM pointsOfInterest), 0.5) ) AS poi
185188
WHERE pointsOfInterest.geom = poi.geom;
186-
UPDATE 6
187189
/* -- p4 */
188190
UPDATE pointsOfInterest SET side = 'b' WHERE pid = 6;
189-
UPDATE 1
190191
/* -- p5 */
192+
ELSE
193+
INSERT INTO pointsOfInterest (edge_id, side, fraction, geom) VALUES
194+
(1, 'l' , 0.4, ST_POINT(1.8, 0.4)),
195+
(15, 'r' , 0.4, ST_POINT(4.2, 2.4)),
196+
(12, 'l' , 0.6, ST_POINT(2.6, 3.2)),
197+
(6, 'r' , 0.3, ST_POINT(0.3, 1.8)),
198+
(5, 'l' , 0.8, ST_POINT(2.9, 1.8)),
199+
(4, 'b' , 0.7, ST_POINT(2.2, 1.7));
200+
END IF;
201+
END;
202+
$BODY$;
203+
DO
191204
SELECT
192205
pid, ST_AsText(geom) geom,
193206
edge_id, fraction AS frac, side, distance AS dist,

docqueries/src/test.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
'any' => {
55
'files' => [qw(
66
sampledata.pg
7-
withPoints-category.pg
8-
migration.pg
9-
concepts.pg
107
)],
118
},
129
);

sql/scripts/build-extension-update-files.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ sub generate_upgrade_script {
271271
}
272272

273273
# updating to 3.7+
274-
if ($old_mayor == 3 && $old_minor < 8) {
274+
if ($old_mayor == 3 && $old_minor >= 4 && $old_minor < 8) {
275275
push @commands, drop_special_case_function("pgr_findcloseedges(text,geometry,double precision,integer,boolean,boolean)");
276276
push @commands, drop_special_case_function("pgr_findcloseedges(text,geometry[],double precision,integer,boolean,boolean)");
277277
}

tools/testers/sampledata.sql

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ FROM edges ORDER BY id;
8787

8888
/* --POINTS CREATE start */
8989

90+
DO LANGUAGE plpgsql $BODY$
91+
DECLARE v FLOAT;
92+
BEGIN
93+
SELECT (parts[1]||'.'||parts[2])::FLOAT FROM STRING_TO_ARRAY(pgr_version(), '.') AS parts INTO v;
9094
/* -- p1 */
9195
CREATE TABLE pointsOfInterest(
9296
pid BIGSERIAL PRIMARY KEY,
@@ -97,6 +101,7 @@ CREATE TABLE pointsOfInterest(
97101
edge geometry,
98102
newPoint geometry,
99103
geom geometry);
104+
IF v > 3.4 THEN
100105
/* -- p2 */
101106
INSERT INTO pointsOfInterest (geom) VALUES
102107
(ST_Point(1.8, 0.4)),
@@ -121,12 +126,24 @@ WHERE pointsOfInterest.geom = poi.geom;
121126
/* -- p4 */
122127
UPDATE pointsOfInterest SET side = 'b' WHERE pid = 6;
123128
/* -- p5 */
129+
ELSE
130+
INSERT INTO pointsOfInterest (edge_id, side, fraction, geom) VALUES
131+
(1, 'l' , 0.4, ST_POINT(1.8, 0.4)),
132+
(15, 'r' , 0.4, ST_POINT(4.2, 2.4)),
133+
(12, 'l' , 0.6, ST_POINT(2.6, 3.2)),
134+
(6, 'r' , 0.3, ST_POINT(0.3, 1.8)),
135+
(5, 'l' , 0.8, ST_POINT(2.9, 1.8)),
136+
(4, 'b' , 0.7, ST_POINT(2.2, 1.7));
137+
END IF;
138+
END;
139+
$BODY$;
140+
/* -- p6 */
124141
SELECT
125142
pid, ST_AsText(geom) geom,
126143
edge_id, fraction AS frac, side, distance AS dist,
127144
ST_AsText(edge) edge, ST_AsText(newPoint) newPoint
128145
FROM pointsOfInterest;
129-
/* -- p6 */
146+
/* -- p7 */
130147
/* --POINTS CREATE end */
131148

132149
/* --COMBINATIONS CREATE start */

0 commit comments

Comments
 (0)