Welcome Guest, Not a member yet? Register   Sign In
Type casting in PostgreSQL with updateBatch()
#18

(01-17-2024, 08:19 PM)kenjis Wrote: Added the docs: https://github.com/codeigniter4/CodeIgniter4/pull/8426
Big thanks   Heart
(01-19-2024, 03:25 PM)sclubricants Wrote: The quick and easy fix for this is to use RawSql as well as casting your php values:
Code:
            $data = [
                [
                    'name'                  => 'Derek Jones',
                    'savings'              => (float) '28389.48',
                    'updated_at' => new RawSql("'2023-12-02 18:47:52'::TIMESTAMP"),
                ],
            ];

https://codeigniter.com/user_guide/datab...tml#rawsql

Another things to have a look at is:

https://www.postgresql.org/docs/current/...ecast.html

Yeah! nice trick.
Reply


Messages In This Thread
RE: Type casting in PostgreSQL with updateBatch() - by MrWhite - 01-19-2024, 10:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB