-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pgsql] invalid input syntax for type boolean: "" #6780
Comments
Could you provide more details on reproducing the issue? This is what I tried: <?php
declare(strict_types=1);
namespace Doctrine\DBAL\Tests;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Schema\Table;
class AdHocTest extends FunctionalTestCase
{
public function testBoolean(): void
{
$table = new Table('t');
$table->addColumn('v', 'boolean');
$this->dropAndCreateTable($table);
$queryBuilder = $this->connection->createQueryBuilder();
$result = $queryBuilder->insert('t')->values([
'v' => $queryBuilder->createNamedParameter(true, ParameterType::BOOLEAN),
])->executeStatement();
self::assertSame(1, $result);
}
} The test passes on both the |
@morozov The problem is when the value is This will work: My connection uses driver: What happens on your setup when you pass value |
Yes, the issue with The underlying issue is that This is similar to #2481 / php/pecl-database-pdo_oci#12. @derrabus do you think this one actually should be fixed in DBAL? Unlike |
Bug Report
Summary
I usually use
$queryBuilder->createNamedParameter($value)
to create queries with prepared statements. Even for boolean values.It was never a problem in mysql, mariadb and mssql in my cases years ago. Sometimes I had to add a type as second parameter.
pgsql now fails when the value ist
false
.Current behavior
When I run one of following code, and the value is
false
Following happens
After some debugging, I worked around to pass a literal
'false'
string.Expected behavior
The Query should succeed with one of these (without having to do an own conversion).
How to reproduce
See the code snippets.
Further
I searched for this issue and found some related issues, but they didn't talk directly about
createNamedParameter
: #1847, #564, #625,The text was updated successfully, but these errors were encountered: