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 unexpectedly
        This probably means the server terminated abnormally
        before 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!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值