Your issue arises because in your transactions table, entity_id is likely stored as a VARCHAR (or TEXT), whereas the id column in the users table is of type BIGINT. PostgreSQL does not automatically cast VARCHAR to BIGINT when comparing them in a WHERE clause.