Skip to content

Commit ba4fc36

Browse files
committed
Add test that runs DuckDB its test_all_types function
This is an easy way to test conversion from Postgres to DuckDB for types that don't have an equivalent in Postgres. It also gives us an easy todo list of types that we don't support yet.
1 parent 64685a4 commit ba4fc36

File tree

3 files changed

+158
-0
lines changed

3 files changed

+158
-0
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
\x on
2+
SET bytea_output = 'escape';
3+
SELECT * FROM duckdb.query($$
4+
FROM test_all_types()
5+
SELECT * exclude(
6+
tinyint, -- PG14 outputs this differently currently
7+
varint,
8+
TIME,
9+
time_tz,
10+
bit,
11+
small_enum,
12+
medium_enum,
13+
large_enum,
14+
timestamptz_array,
15+
struct,
16+
struct_of_arrays,
17+
array_of_structs,
18+
map,
19+
"union",
20+
fixed_int_array,
21+
fixed_varchar_array,
22+
fixed_nested_int_array,
23+
fixed_nested_varchar_array,
24+
fixed_struct_array,
25+
struct_of_fixed_array,
26+
fixed_array_of_int_list,
27+
list_of_fixed_int_array,
28+
nested_int_array, -- The nested array has different lengths, which is not possible in PG
29+
)
30+
$$)
31+
-[ RECORD 1 ]---+-------------------------------------------------------------------------------------------------------------------------------------
32+
bool | f
33+
smallint | -32768
34+
int | -2147483648
35+
bigint | -9223372036854775808
36+
hugeint | 0
37+
uhugeint | 0
38+
utinyint | 0
39+
usmallint | 0
40+
uint | 0
41+
ubigint | 0
42+
date | 07-14-5881580
43+
timestamp | Sun Jan 10 08:01:49.551616 294247
44+
timestamp_s | Sun Jan 10 08:01:49.551616 294247
45+
timestamp_ms | Sun Jan 10 08:01:49.551616 294247
46+
timestamp_ns | Wed Sep 22 00:00:00 1677
47+
timestamp_tz | Sun Jan 10 00:01:49.551616 294247 PST
48+
float | -3.4028235e+38
49+
double | -1.7976931348623157e+308
50+
dec_4_1 | -999.9
51+
dec_9_4 | -99999.9999
52+
dec_18_6 | -999999999999.999999
53+
dec38_10 | -9999999999999999999999999999.9999999999
54+
uuid | 00000000-0000-0000-0000-000000000000
55+
interval | @ 0
56+
varchar | 🦆🦆🦆🦆🦆🦆
57+
blob | thisisalongblob\000withnullbytes
58+
int_array | {}
59+
double_array | {}
60+
date_array | {}
61+
timestamp_array | {}
62+
varchar_array | {}
63+
-[ RECORD 2 ]---+-------------------------------------------------------------------------------------------------------------------------------------
64+
bool | t
65+
smallint | 32767
66+
int | 2147483647
67+
bigint | 9223372036854775807
68+
hugeint | 170141183460469231731687303715884105727
69+
uhugeint | 340282366920938463463374607431768211455
70+
utinyint | 255
71+
usmallint | 65535
72+
uint | 4294967295
73+
ubigint | 18446744073709551615
74+
date | 07-10-5881580
75+
timestamp | Sun Jan 10 04:00:54.775806 294247
76+
timestamp_s | Sun Jan 10 04:00:54 294247
77+
timestamp_ms | Sun Jan 10 04:00:54.775 294247
78+
timestamp_ns | Fri Apr 11 23:47:16.854775 2262
79+
timestamp_tz | Sat Jan 09 20:00:54.775806 294247 PST
80+
float | 3.4028235e+38
81+
double | 1.7976931348623157e+308
82+
dec_4_1 | 999.9
83+
dec_9_4 | 99999.9999
84+
dec_18_6 | 999999999999.999999
85+
dec38_10 | 9999999999999999999999999999.9999999999
86+
uuid | ffffffff-ffff-ffff-ffff-ffffffffffff
87+
interval | @ 83 years 3 mons 999 days 16 mins 39.999999 secs
88+
varchar | goo
89+
blob | \000\000\000a
90+
int_array | {42,999,NULL,NULL,-42}
91+
double_array | {42,NaN,Infinity,-Infinity,NULL,-42}
92+
date_array | {01-01-1970,07-11-5881580,07-13-5881580,NULL,05-12-2022}
93+
timestamp_array | {"Thu Jan 01 00:00:00 1970","Sun Jan 10 04:00:54.775807 294247","Sun Jan 10 04:00:54.775809 294247",NULL,"Thu May 12 16:23:45 2022"}
94+
varchar_array | {🦆🦆🦆🦆🦆🦆,goose,NULL,""}
95+
-[ RECORD 3 ]---+-------------------------------------------------------------------------------------------------------------------------------------
96+
bool |
97+
smallint |
98+
int |
99+
bigint |
100+
hugeint |
101+
uhugeint |
102+
utinyint |
103+
usmallint |
104+
uint |
105+
ubigint |
106+
date |
107+
timestamp |
108+
timestamp_s |
109+
timestamp_ms |
110+
timestamp_ns |
111+
timestamp_tz |
112+
float |
113+
double |
114+
dec_4_1 |
115+
dec_9_4 |
116+
dec_18_6 |
117+
dec38_10 |
118+
uuid |
119+
interval |
120+
varchar |
121+
blob |
122+
int_array |
123+
double_array |
124+
date_array |
125+
timestamp_array |
126+
varchar_array |
127+

test/regression/schedule

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ test: execution_error
66
test: extensions
77
test: type_support
88
test: array_type_support
9+
test: test_all_types
910
test: views
1011
test: non_superuser
1112
test: projection_pushdown_unsupported_type
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
\x on
2+
SET bytea_output = 'escape';
3+
SELECT * FROM duckdb.query($$
4+
FROM test_all_types()
5+
SELECT * exclude(
6+
tinyint, -- PG14 outputs this differently currently
7+
varint,
8+
TIME,
9+
time_tz,
10+
bit,
11+
small_enum,
12+
medium_enum,
13+
large_enum,
14+
timestamptz_array,
15+
struct,
16+
struct_of_arrays,
17+
array_of_structs,
18+
map,
19+
"union",
20+
fixed_int_array,
21+
fixed_varchar_array,
22+
fixed_nested_int_array,
23+
fixed_nested_varchar_array,
24+
fixed_struct_array,
25+
struct_of_fixed_array,
26+
fixed_array_of_int_list,
27+
list_of_fixed_int_array,
28+
nested_int_array, -- The nested array has different lengths, which is not possible in PG
29+
)
30+
$$)

0 commit comments

Comments
 (0)