Hi, Matteo,

> The last time I tried to fix the PDO_PARAM_INT behavior on pdo_pgsql I broke 
> Laravel and surely many other projects.
> https://github.com/php/php-src/pull/6801

Thank you for providing an important example.

Regarding this past issue with PostgreSQL, it can be solved by
treating numbers larger than `int4` as `unknown` (as is the case now)
rather than as `int8` (as in previous attempts).

This approach aligns with PostgreSQL's capability to cast `integer` to
`boolean` but not `smallint` or `bigint`. This consideration is
crucial for ensuring interoperability.

````
postgres=# select 1::integer::boolean ; -- returns `t`
postgres=# select 1::smallint::boolean ; -- `ERROR: cannot cast type
smallint to boolean`
postgres=# select 1::bigint::boolean ; -- `ERROR: cannot cast type
bigint to boolean`
````

It is certainly not realistic to unify behavior across all databases.
Also, as in the example above, there are certainly places where each
database requires individual support.

I think it would be good if a solution could be found that would allow
for more correct behavior without breaking the behavior of existing
applications.

Your insights and contributions are interesting and invaluable. They
are much appreciated.
Best regards

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to