duckdb_pgwire插件的几个问题
psql终端无法接收duckdb抛出的错误,测试用例
D select 1234567890*1234567890 a;
Out of Range Error:
Overflow in multiplication of INT32 (1234567890 * 1234567890)!
main=> select 1234567890*1234567890 a;
终端没有输出,也不接收任何输入,除非退出服务端,才能退出
\q
server closed the connection unexpectedlyThis probably means the server terminated abnormallybefore or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
The connection to the server was lost. Attempting reset: Failed.
!?> \q
root@6ae32a5ffcde:/#
不支持int128类型的输出,测试用例
D select sum(i) from range(1,10000001)t(i);
┌──────────────────┐
│ sum(i) │
│ int128 │
├──────────────────┤
│ 50000005000000 │
│ (50.00 trillion) │
└──────────────────┘main=> select sum(i) from range(1,10000001)t(i);
--
(1 row)
这个问题在结果不超过int64的时候可以用强制转换bigint输出,超过就没办法了,因为duckdb_pgwire源代码没有处理int128类型。
main=> select sum(i)::bigint from range(1,10000001)t(i);CAST(sum(i) AS BIGINT)
------------------------50000005000000
(1 row)
不需要输出成数值,则可以用强制转换成字符串解决
main=> select (1234567890::hugeint*1234567890*1234567890)::varchar a;a
------------------------------1881676371789154860897069000
(1 row)
不支持pivot语句
main=> PIVOT cities
ON year
USING sum(population);
ERROR: Invalid Input Error: Cannot prepare multiple statements at once!