1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
--
-- LINE
-- Infinite lines
--
--DROP TABLE LINE_TBL;
CREATE TABLE LINE_TBL (s line);
INSERT INTO LINE_TBL VALUES ('{0,-1,5}'); -- A == 0
INSERT INTO LINE_TBL VALUES ('{1,0,5}'); -- B == 0
INSERT INTO LINE_TBL VALUES ('{0,3,0}'); -- A == C == 0
INSERT INTO LINE_TBL VALUES (' (0,0), (6,6)');
INSERT INTO LINE_TBL VALUES ('10,-10 ,-5,-4');
INSERT INTO LINE_TBL VALUES ('[-1e6,2e2,3e5, -4e1]');
INSERT INTO LINE_TBL VALUES ('{3,NaN,5}');
INSERT INTO LINE_TBL VALUES ('{NaN,NaN,NaN}');
-- horizontal
INSERT INTO LINE_TBL VALUES ('[(1,3),(2,3)]');
-- vertical
INSERT INTO LINE_TBL VALUES (line(point '(3,1)', point '(3,2)'));
-- bad values for parser testing
INSERT INTO LINE_TBL VALUES ('{}');
ERROR: invalid input syntax for type line: "{}"
LINE 1: INSERT INTO LINE_TBL VALUES ('{}');
^
INSERT INTO LINE_TBL VALUES ('{0');
ERROR: invalid input syntax for type line: "{0"
LINE 1: INSERT INTO LINE_TBL VALUES ('{0');
^
INSERT INTO LINE_TBL VALUES ('{0,0}');
ERROR: invalid input syntax for type line: "{0,0}"
LINE 1: INSERT INTO LINE_TBL VALUES ('{0,0}');
^
INSERT INTO LINE_TBL VALUES ('{0,0,1');
ERROR: invalid input syntax for type line: "{0,0,1"
LINE 1: INSERT INTO LINE_TBL VALUES ('{0,0,1');
^
INSERT INTO LINE_TBL VALUES ('{0,0,1}');
ERROR: invalid line specification: A and B cannot both be zero
LINE 1: INSERT INTO LINE_TBL VALUES ('{0,0,1}');
^
INSERT INTO LINE_TBL VALUES ('{0,0,1} x');
ERROR: invalid input syntax for type line: "{0,0,1} x"
LINE 1: INSERT INTO LINE_TBL VALUES ('{0,0,1} x');
^
INSERT INTO LINE_TBL VALUES ('(3asdf,2 ,3,4r2)');
ERROR: invalid input syntax for type line: "(3asdf,2 ,3,4r2)"
LINE 1: INSERT INTO LINE_TBL VALUES ('(3asdf,2 ,3,4r2)');
^
INSERT INTO LINE_TBL VALUES ('[1,2,3, 4');
ERROR: invalid input syntax for type line: "[1,2,3, 4"
LINE 1: INSERT INTO LINE_TBL VALUES ('[1,2,3, 4');
^
INSERT INTO LINE_TBL VALUES ('[(,2),(3,4)]');
ERROR: invalid input syntax for type line: "[(,2),(3,4)]"
LINE 1: INSERT INTO LINE_TBL VALUES ('[(,2),(3,4)]');
^
INSERT INTO LINE_TBL VALUES ('[(1,2),(3,4)');
ERROR: invalid input syntax for type line: "[(1,2),(3,4)"
LINE 1: INSERT INTO LINE_TBL VALUES ('[(1,2),(3,4)');
^
INSERT INTO LINE_TBL VALUES ('[(1,2),(1,2)]');
ERROR: invalid line specification: must be two distinct points
LINE 1: INSERT INTO LINE_TBL VALUES ('[(1,2),(1,2)]');
^
INSERT INTO LINE_TBL VALUES (line(point '(1,0)', point '(1,0)'));
ERROR: invalid line specification: must be two distinct points
select * from LINE_TBL;
s
------------------------------------------------
{0,-1,5}
{1,0,5}
{0,3,0}
{1,-1,0}
{-0.4,-1,-6}
{-0.0001846153846153846,-1,15.384615384615387}
{3,NaN,5}
{NaN,NaN,NaN}
{0,-1,3}
{-1,0,3}
(10 rows)
select '{nan, 1, nan}'::line = '{nan, 1, nan}'::line as true,
'{nan, 1, nan}'::line = '{nan, 2, nan}'::line as false;
true | false
------+-------
t | f
(1 row)
|