Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d5dd9b

Browse files
author
Thomas G. Lockhart
committed
Start adding tests for new geometry functions.
Not all cleaned up yet.
1 parentc503564 commit3d5dd9b

File tree

5 files changed

+109
-48
lines changed

5 files changed

+109
-48
lines changed

‎src/test/regress/sql/circle.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5;
3939

4040
SELECT''AS four, f1FROM CIRCLE_TBLWHERE diameter(f1)>=10;
4141

42-
SELECT''as five,c1.f1AS one,c2.f1AS two, (c1.f1<===>c2.f1)AS distance
42+
SELECT''as five,c1.f1AS one,c2.f1AS two, (c1.f1<->c2.f1)AS distance
4343
FROM CIRCLE_TBL c1, CIRCLE_TBL c2
44-
WHERE (c1.f1<c2.f1)AND ((c1.f1<===>c2.f1)>0)
44+
WHERE (c1.f1<c2.f1)AND ((c1.f1<->c2.f1)>0)
4545
ORDER BY distance, one, two;
4646

‎src/test/regress/sql/geometry.sql

Lines changed: 88 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,54 @@
22
-- Points
33
--
44

5-
SELECTpoint(f1)FROM CIRCLE_TBL;
5+
SELECT''AS xxx, center(f1)AS center
6+
FROM BOX_TBL;
67

8+
SELECT''AS xxx, (@@ f1)AS center
9+
FROM BOX_TBL;
10+
11+
SELECT''AS xxx,point(f1)AS center
12+
FROM CIRCLE_TBL;
13+
14+
SELECT''AS xxx, (@@ f1)AS center
15+
FROM CIRCLE_TBL;
16+
17+
SELECT''AS xxx, (@@ f1)AS center
18+
FROM POLYGON_TBL
19+
WHERE (# f1) > 2;
20+
21+
-- "is horizontal" function
722
SELECT''AS two,p1.f1
8-
FROM POINT_TBL p1
9-
WHERE ishorizontal(p1.f1,'(0,0)'::point);
23+
FROM POINT_TBL p1
24+
WHERE ishorizontal(p1.f1,'(0,0)'::point);
1025

26+
-- "is horizontal" operator
27+
SELECT''AS two,p1.f1
28+
FROM POINT_TBL p1
29+
WHEREp1.f1 ?-'(0,0)'::point;
30+
31+
-- "is vertical" function
32+
SELECT''AS one,p1.f1
33+
FROM POINT_TBL p1
34+
WHERE isvertical(p1.f1,'(5.1,34.5)'::point);
35+
36+
-- "is vertical" operator
1137
SELECT''AS one,p1.f1
12-
FROM POINT_TBL p1
13-
WHEREisvertical(p1.f1,'(5.1,34.5)'::point);
38+
FROM POINT_TBL p1
39+
WHEREp1.f1 ?|'(5.1,34.5)'::point;
1440

1541
--
1642
-- Line segments
1743
--
1844

45+
-- intersection
46+
SELECT''AS xxx,p.f1,l.s,l.s# p.f1 AS intersection
47+
FROM LSEG_TBL l, POINT_TBL p;
48+
49+
-- closest point
50+
SELECT''AS xxx,p.f1,l.s,p.f1## l.s AS closest
51+
FROM LSEG_TBL l, POINT_TBL p;
52+
1953
--
2054
-- Lines
2155
--
@@ -24,64 +58,91 @@ SELECT '' AS one, p1.f1
2458
-- Boxes
2559
--
2660

27-
SELECT center(f1)FROM BOX_TBL;
28-
29-
SELECTbox(f1)FROM CIRCLE_TBL;
61+
SELECTbox(f1)ASboxFROM CIRCLE_TBL;
3062

3163
-- translation
32-
SELECT''AS count,b.f1+p.f1
33-
FROM BOX_TBL b, POINT_TBL p;
64+
SELECT''AS count,b.f1+p.f1AS translation
65+
FROM BOX_TBL b, POINT_TBL p;
66+
67+
SELECT''AS count,b.f1-p.f1AS translation
68+
FROM BOX_TBL b, POINT_TBL p;
3469

3570
-- scaling and rotation
36-
SELECT''AS count,b.f1*p.f1
37-
FROM BOX_TBL b, POINT_TBL p;
71+
SELECT''AS count,b.f1*p.f1AS rotation
72+
FROM BOX_TBL b, POINT_TBL p;
73+
74+
SELECT''AS count,b.f1/p.f1AS rotation
75+
FROM BOX_TBL b, POINT_TBL p
76+
WHERE (p.f1<->'(0,0)'::point)>=1;
3877

3978
--
4079
-- Paths
4180
--
4281

4382
SET geqo TO'off';
4483

45-
SELECT points(f1)AS npoints, f1ASpathFROM PATH_TBL;
84+
SELECT''AS xxx,points(f1)AS npoints, f1ASpathFROM PATH_TBL;
4685

47-
SELECTpath(f1)FROM POLYGON_TBL;
86+
SELECT''AS xxx,path(f1)FROM POLYGON_TBL;
4887

4988
-- translation
5089
SELECT''AS eight,p1.f1+'(10,10)'::pointAS dist_add
51-
FROM PATH_TBL p1;
90+
FROM PATH_TBL p1;
5291

5392
-- scaling and rotation
5493
SELECT''AS eight,p1.f1*'(2,-1)'::pointAS dist_mul
55-
FROM PATH_TBL p1;
94+
FROM PATH_TBL p1;
5695

5796
RESET geqo;
5897

5998
--
6099
-- Polygons
61100
--
62101

63-
SELECT points(f1)AS npoints, f1ASpolygonFROM POLYGON_TBL;
102+
-- containment
103+
SELECT''AS xxx,p.f1,poly.f1,poly.f1 ~p.f1AS contains
104+
FROM POLYGON_TBL poly, POINT_TBL p;
64105

65-
SELECTpolygon(f1)FROM BOX_TBL;
106+
SELECT''AS xxx,p.f1,poly.f1,p.f1 @poly.f1AS contained
107+
FROM POLYGON_TBL poly, POINT_TBL p;
66108

67-
SELECTpolygon(f1)FROM PATH_TBLWHERE isclosed(f1);
109+
SELECT''AS xxx, points(f1)AS npoints, f1ASpolygon
110+
FROM POLYGON_TBL;
68111

69-
SELECT f1AS open_path,polygon( pclose(f1))ASpolygonFROM PATH_TBLWHERE isopen(f1);
112+
SELECT''AS xxx,polygon(f1)
113+
FROM BOX_TBL;
114+
115+
SELECT''AS xxx,polygon(f1)
116+
FROM PATH_TBLWHERE isclosed(f1);
117+
118+
SELECT''AS xxx, f1AS open_path,polygon( pclose(f1))ASpolygon
119+
FROM PATH_TBL
120+
WHERE isopen(f1);
70121

71122
-- convert circles to polygons using the default number of points
72-
SELECTpolygon(f1)FROM CIRCLE_TBL;
123+
SELECT''AS xxx,polygon(f1)
124+
FROM CIRCLE_TBL;
73125

74126
-- convert the circle to an 8-point polygon
75-
SELECTpolygon(8, f1)FROM CIRCLE_TBL;
127+
SELECT''AS xxx,polygon(8, f1)
128+
FROM CIRCLE_TBL;
76129

77130
--
78131
-- Circles
79132
--
80133

81-
SELECTcircle( f1,50.0)FROM POINT_TBL;
134+
SELECT''AS xxx,circle(f1,50.0)
135+
FROM POINT_TBL;
136+
137+
SELECT''AS xxx,circle(f1)
138+
FROM BOX_TBL;
139+
140+
SELECT''AS xxx,circle(f1)
141+
FROM POLYGON_TBL
142+
WHERE (# f1) >= 2;
82143

83-
SELECT''AS twentyfour,c1.f1AScircle,p1.f1ASpoint, (p1.f1<===>c1.f1)AS distance
84-
from CIRCLE_TBL c1, POINT_TBL p1
85-
WHERE (p1.f1<===>c1.f1)>0
86-
ORDER BY distance,circle;
144+
SELECT''AS twentyfour,c1.f1AScircle,p1.f1ASpoint, (p1.f1<->c1.f1)AS distance
145+
FROM CIRCLE_TBL c1, POINT_TBL p1
146+
WHERE (p1.f1<->c1.f1)>0
147+
ORDER BY distance,circle;
87148

‎src/test/regress/sql/lseg.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ select * from LSEG_TBL;
2121

2222
SELECT*FROM LSEG_TBLWHERE s<='[(1,2),(3,4)]'::lseg;
2323

24-
SELECT*FROM LSEG_TBLWHERE (s<===>'[(1,2),(3,4)]'::lseg)<10;
24+
SELECT*FROM LSEG_TBLWHERE (s<->'[(1,2),(3,4)]'::lseg)<10;
2525

‎src/test/regress/sql/point.sql

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,54 +25,54 @@ INSERT INTO POINT_TBL(f1) VALUES ('(10.0,10.0');
2525
SELECT''AS six, POINT_TBL.*;
2626

2727
-- left of
28-
SELECT''AS three, p.*FROM POINT_TBL pWHEREp.f1!<'(0.0, 0.0)';
28+
SELECT''AS three, p.*FROM POINT_TBL pWHEREp.f1<<'(0.0, 0.0)';
2929

3030
-- right of
31-
SELECT''AS three, p.*FROM POINT_TBL pWHERE'(0.0,0.0)'!>p.f1;
31+
SELECT''AS three, p.*FROM POINT_TBL pWHERE'(0.0,0.0)'>>p.f1;
3232

3333
-- above
34-
SELECT''AS one, p.*FROM POINT_TBL pWHERE'(0.0,0.0)'!^p.f1;
34+
SELECT''AS one, p.*FROM POINT_TBL pWHERE'(0.0,0.0)'>^p.f1;
3535

3636
-- below
37-
SELECT''AS one, p.*FROM POINT_TBL pWHEREp.f1!|'(0.0, 0.0)';
37+
SELECT''AS one, p.*FROM POINT_TBL pWHEREp.f1<^'(0.0, 0.0)';
3838

3939
-- equal
40-
SELECT''AS one, p.*FROM POINT_TBL pWHEREp.f1=|='(5.1, 34.5)';
40+
SELECT''AS one, p.*FROM POINT_TBL pWHEREp.f1~='(5.1, 34.5)';
4141

4242
-- point in box
4343
SELECT''AS three, p.*FROM POINT_TBL p
44-
WHEREp.f1===>'(0,0,100,100)';
44+
WHEREp.f1@'(0,0,100,100)'::box;
4545

4646
SELECT''AS three, p.*FROM POINT_TBL p
47-
WHERE noton_pb(p.f1,'(0,0,100,100)'::box);
47+
WHERE notp.f1 @'(0,0,100,100)'::box;
4848

4949
SELECT''AS two, p.*FROM POINT_TBL p
50-
WHEREon_ppath(p.f1,'[(0,0),(-10,0),(-10,10)]'::path);
50+
WHEREp.f1 @'[(0,0),(-10,0),(-10,10)]'::path;
5151

52-
SELECT''AS six,p.f1,p.f1<===>'(0,0)'::pointAS dist
52+
SELECT''AS six,p.f1,p.f1<->'(0,0)'::pointAS dist
5353
FROM POINT_TBL p
5454
ORDER BY dist;
5555

5656
SET geqo TO'off';
5757

58-
SELECT''AS thirtysix,p1.f1AS point1,p2.f1AS point2,p1.f1<===>p2.f1AS dist
58+
SELECT''AS thirtysix,p1.f1AS point1,p2.f1AS point2,p1.f1<->p2.f1AS dist
5959
FROM POINT_TBL p1, POINT_TBL p2
6060
ORDER BY dist;
6161

6262
SELECT''AS thirty,p1.f1AS point1,p2.f1AS point2
6363
FROM POINT_TBL p1, POINT_TBL p2
64-
WHERE (p1.f1<===>p2.f1)>3;
64+
WHERE (p1.f1<->p2.f1)>3;
6565

6666
-- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10
67-
SELECT''AS fifteen,p1.f1AS point1,p2.f1AS point2, (p1.f1<===>p2.f1)AS distance
67+
SELECT''AS fifteen,p1.f1AS point1,p2.f1AS point2, (p1.f1<->p2.f1)AS distance
6868
FROM POINT_TBL p1, POINT_TBL p2
69-
WHERE (p1.f1<===>p2.f1)>3andp1.f1!<p2.f1
69+
WHERE (p1.f1<->p2.f1)>3andp1.f1<<p2.f1
7070
ORDER BY distance;
7171

7272
-- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10
73-
SELECT''AS three,p1.f1AS point1,p2.f1AS point2, (p1.f1<===>p2.f1)AS distance
73+
SELECT''AS three,p1.f1AS point1,p2.f1AS point2, (p1.f1<->p2.f1)AS distance
7474
FROM POINT_TBL p1, POINT_TBL p2
75-
WHERE (p1.f1<===>p2.f1)>3andp1.f1!<p2.f1andp1.f1!^p2.f1
75+
WHERE (p1.f1<->p2.f1)>3andp1.f1<<p2.f1andp1.f1>^p2.f1
7676
ORDER BY distance;
7777

7878
RESET geqo;

‎src/test/regress/sql/polygon.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ SELECT '' AS zero, p.*
6767
-- contained
6868
SELECT''AS one, p.*
6969
FROM POLYGON_TBL p
70-
WHEREp.f1 @'(3.0,1.0),(3.0,3.0),(1.0,0.0)';
70+
WHEREp.f1 @'(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon;
7171

7272
-- same
7373
SELECT''AS one, p.*
7474
FROM POLYGON_TBL p
75-
WHEREp.f1 ~='(3.0,1.0),(3.0,3.0),(1.0,0.0)';
75+
WHEREp.f1 ~='(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon;
7676

7777
-- contains
7878
SELECT''AS one, p.*
7979
FROM POLYGON_TBL p
80-
WHEREp.f1 ~'(3.0,1.0),(3.0,3.0),(1.0,0.0)';
80+
WHEREp.f1 ~'(3.0,1.0),(3.0,3.0),(1.0,0.0)'::polygon;
8181

8282
--
8383
-- polygon logic

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp