You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: [Postgre] updateBatch() fails for mixed PHP value types in a TEXT column #10599
Which operating systems have you tested for this bug?
Linux
Which server did you use?
cli
Environment
development
Database
PostgreSQL 16
What happened?
Query Builder's updateBatch() returns 0 and marks the transaction as failed
when rows supply a string and an integer for the same TEXT column.
PostgreSQL reports:
ERROR: invalid input syntax for type integer: "Example"
The generated UPDATE uses a UNION ALL subquery containing both
'Example' and 587 in its value column. PostgreSQL attempts to infer
that subquery column's type before the outer CAST(... AS TEXT).
This uses only CodeIgniter Query Builder, not the Settings package.
Expected Output
Both rows are updated successfully. The integer 587 can be stored in
the TEXT column as "587", and the transaction remains successful.
Anything else?
Generated SQL includes:
SELECT 1 "id", 'Example' "value" UNION ALL
SELECT 2 "id", 587 "value"
This differs from the PostgreSQL updateBatch() issue #7387, which was
closed by #8439; the behavior above still reproduces on v4.7.4.
I first encountered this through CodeIgniter Settings v2.4.0:
setMany() fails when updating existing settings containing both string
and integer values. The standalone Query Builder reproduction above
shows that the failure also occurs without the Settings package.
Activity