TP5.1 pgsql insertAl报类型错误

浏览:481 发布日期:2021/03/10 分类:ThinkPHP5专区 关键字: 数据库 pgsql
TP5.1 pgsql数据库批量插入使用insertAll时,sql原码如下:
insert into test (age) select '1' union all select '1'
age int类型
报错如下:
ERROR: column "age" is of type integer but expression is of type text

数据报错类型错误,pgsql union all后的数据库插入需要和前面字段同类型,不知道各位有没有什么好的解决办法

如果是insert into (age) values ('1'),('1')这样是不区分类型,但是想直接可以使用insertAll
最佳答案
评论( 相关
后面还有条评论,点击查看>>