postgresql-for-doctrine icon indicating copy to clipboard operation
postgresql-for-doctrine copied to clipboard

fix: parse text[] as array<string>

Open adrienbrault opened this issue 2 years ago • 0 comments

Hey,

The way MartinGeorgiev\Doctrine\DBAL\Types\TextArray converts database values to php floats/int broke my expectations.

When I save ['a', '1', '0.1'] to my database, I expect to get back the same ['a', '1', '0.1'], NOT ['a', 1, 0.1]. Especially when the column name is "text".

I also checked postgres itself, and there is no magic casting:

database=# select pg_typeof(('{0.4}'::text[])[1]);
 pg_typeof
-----------
 text
(1 row)

adrienbrault avatar Sep 12 '23 09:09 adrienbrault