不能将0或1存储为布尔laravel postgresql [英] cant store 0 or 1 as boolean laravel postgresql

查看:45
本文介绍了不能将0或1存储为布尔laravel postgresql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够将布尔值存储为0或1,但是突然之间,它一直向我返回错误

I was able to store boolean values as 0 or 1 , but suddenly it keeps returning me the error

column \"trial\" is of type boolean but expression is of type integer

我在laravel 8中使用了postgresql 13

Im using postgresql 13 with laravel 8

我该如何解决?

推荐答案

如果您使用的是PHP 7.4.18或8.0.5,请注意重大更改:

If you are on PHP 7.4.18 or 8.0.5 then watch for a breaking change:

来自 Github PHP#6801 :

总而言之,以前,如果您在Postgres上有一个布尔列表中,您可以在其中绑定一个整数值(通常为0或1)使用PDO :: PARAM_INT针对该列的条件,并且一切都是美好的.但是,您现在将收到一个错误.

In summary, previously if you had a boolean column on a Postgres table, you could bind an integer value (0 or 1 typically) in the where condition against that column using PDO::PARAM_INT and everything was fine. However, you will now receive an error.

虽然该修复程序已经还原,但我们需要降级至7.4.16/8.0.3或等待下一个补丁程序发行.参见 PHP问题#80892

While the fix was already reverted, we need to downgrade to 7.4.16 / 8.0.3 or wait for the next patch release. See PHP Issue #80892

这篇关于不能将0或1存储为布尔laravel postgresql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆