forked from MaterializeInc/materialize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
int2vector.slt
129 lines (106 loc) · 2.03 KB
/
int2vector.slt
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.
# 🔬🔬 int2vector
query T
SELECT '1'::int2vector::text
----
1
query T
SELECT '1'::text::int2vector::text
----
1
query T
SELECT '1'::pg_catalog.int2vector::text
----
1
query T
SELECT '1 2 3'::int2vector::text
----
1 2 3
query T
SELECT '1 2 3'::int2vector::int2[]::text
----
{1,2,3}
query T
SELECT null::int2vector::text
----
NULL
query T
SELECT null::int2vector::int2[]::text
----
NULL
query error invalid input syntax for type int2vector
SELECT 'a'::int2vector::text
query error CAST does not support casting from smallint\[\] to int2vector
SELECT '{1,2,3}'::int2[]::int2vector::text
query T
SELECT ('1 2 3'::int2vector)[1]::text;
----
2
query T
SELECT ('1 2 3'::int2vector::int2[])[1]::text;
----
1
query T
SELECT ('1 2'::int2vector || '{3}'::int2[])::text;
----
{1,2,3}
query T
SELECT ('{1,2}'::int2[] || '3'::int2vector)::text;
----
{1,2,3}
query T
SELECT array_cat('1 2'::int2vector, '{3}'::int2[])::text;
----
{1,2,3}
query T
SELECT array_cat('{1,2}'::int2[], '3'::int2vector)::text;
----
{1,2,3}
query I
SELECT array_length('{1,2}'::int2[], 1);
----
2
query I
SELECT array_length('1 2'::int2vector, 1);
----
2
query T
SELECT ('{1 2 3, 4 5 6}'::int2vector[])[2]::text;
----
4 5 6
query T
SELECT ('{1 2 3, 4 5 6}'::int2vector[])[2][1]::text;
----
NULL
query T
SELECT (('{1 2 3, 4 5 6}'::int2vector[])[2])[1]::text;
----
5
query T
SELECT ARRAY (SELECT * FROM (VALUES ('1 2'::INT2VECTOR), ('3 4')))::text;
----
{"1 2","3 4"}
query TII
SELECT
l.b::text, l.a, r.a
FROM
(
SELECT
5 AS a,
ARRAY (SELECT * FROM (VALUES ('1 2'::INT2VECTOR), ('3 4')))
AS b
)
AS l
JOIN (SELECT 6 AS a, '{1 2, 3 4}'::INT2VECTOR[] AS b) AS r ON
l.b = r.b;
----
{"1 2","3 4"}
5
6