nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.34k stars 4.06k forks source link

\OCP\DB\QueryBuilder\IExpressionBuilder::eq and the $type param #20598

Open ChristophWurst opened 4 years ago

ChristophWurst commented 4 years ago

How to use GitHub

Steps to reproduce

  1. Join two tables on a.x = b.y where a.x is an int and b.y is a varchar

Expected behaviour

Using an explicit type for \OCP\DB\QueryBuilder\IExpressionBuilder::eq I might expect the expressions to be type cased so the comparison works.

Actual behaviour

This blows up on postgres (at least, possibly also on strict mysql).

Ref https://github.com/nextcloud/mail/pull/2970 Ref https://github.com/nextcloud/mail/pull/2796

cc @nickvergessen

nickvergessen commented 4 years ago

There is code in OCIExpressionBuilder that could be copied. Might also be necessary for mysql strict mode. Quite dangerous so let's experiment after stable19

szaimen commented 3 years ago

Is this Issue still valid? If not, please close this issue. Thanks! :)

szaimen commented 1 year ago

Hi, please update to 24.0.8 or better 25.0.2 and report back if it fixes the issue. Thank you!

nickvergessen commented 1 year ago

Type is still not used here: https://github.com/nextcloud/server/blob/master/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php#L142-L146 And the function not overwritten in the PgSqlExpressionBuilder.