OSDN Git Service

Message editing: remove gratuitous variations in message wording, standardize
[pg-rex/syncrep.git] / src / test / regress / expected / circle.out
1 --
2 -- CIRCLE
3 --
4 CREATE TABLE CIRCLE_TBL (f1 circle);
5 INSERT INTO CIRCLE_TBL VALUES ('<(5,1),3>');
6 INSERT INTO CIRCLE_TBL VALUES ('<(1,2),100>');
7 INSERT INTO CIRCLE_TBL VALUES ('1,3,5');
8 INSERT INTO CIRCLE_TBL VALUES ('((1,2),3)');
9 INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10>');
10 INSERT INTO CIRCLE_TBL VALUES ('<(100,1),115>');
11 -- bad values
12 INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
13 ERROR:  invalid input syntax for type circle: "<(-100,0),-100>"
14 INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
15 ERROR:  invalid input syntax for type circle: "1abc,3,5"
16 INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
17 ERROR:  invalid input syntax for type circle: "(3,(1,2),3)"
18 SELECT * FROM CIRCLE_TBL;
19        f1       
20 ----------------
21  <(5,1),3>
22  <(1,2),100>
23  <(1,3),5>
24  <(1,2),3>
25  <(100,200),10>
26  <(100,1),115>
27 (6 rows)
28
29 SELECT '' AS six, center(f1) AS center
30   FROM CIRCLE_TBL;
31  six |  center   
32 -----+-----------
33      | (5,1)
34      | (1,2)
35      | (1,3)
36      | (1,2)
37      | (100,200)
38      | (100,1)
39 (6 rows)
40
41 SELECT '' AS six, radius(f1) AS radius
42   FROM CIRCLE_TBL;
43  six | radius 
44 -----+--------
45      |      3
46      |    100
47      |      5
48      |      3
49      |     10
50      |    115
51 (6 rows)
52
53 SELECT '' AS six, diameter(f1) AS diameter
54   FROM CIRCLE_TBL;
55  six | diameter 
56 -----+----------
57      |        6
58      |      200
59      |       10
60      |        6
61      |       20
62      |      230
63 (6 rows)
64
65 SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5;
66  two |    f1     
67 -----+-----------
68      | <(5,1),3>
69      | <(1,2),3>
70 (2 rows)
71
72 SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10;
73  four |       f1       
74 ------+----------------
75       | <(1,2),100>
76       | <(1,3),5>
77       | <(100,200),10>
78       | <(100,1),115>
79 (4 rows)
80
81 SELECT '' as five, c1.f1 AS one, c2.f1 AS two, (c1.f1 <-> c2.f1) AS distance
82   FROM CIRCLE_TBL c1, CIRCLE_TBL c2
83   WHERE (c1.f1 < c2.f1) AND ((c1.f1 <-> c2.f1) > 0)
84   ORDER BY distance, one USING < , two USING < ;
85  five |      one       |      two       |     distance     
86 ------+----------------+----------------+------------------
87       | <(100,200),10> | <(100,1),115>  |               74
88       | <(100,200),10> | <(1,2),100>    | 111.370729772479
89       | <(1,3),5>      | <(100,200),10> | 205.476756144497
90       | <(5,1),3>      | <(100,200),10> |  207.51303816328
91       | <(1,2),3>      | <(100,200),10> | 208.370729772479
92 (5 rows)
93