E0007 join-type-mismatch
JOIN condition compares incompatible types.
| Code | Name | Category | Default |
|---|---|---|---|
E0007 | join-type-mismatch | correctness | error |
What it reports
A JOIN ... ON condition compares columns whose types can't be compared. This usually means the wrong column was joined.
Example
SELECT u.id FROM users u JOIN orders o ON o.user_id = u.email;
error[E0007]: JOIN condition type mismatch: integer vs text
--> q.sql:1:43
|
1 | SELECT u.id FROM users u JOIN orders o ON o.user_id = u.email;
| ^^^^^^^^^
= help: JOIN condition should compare compatible types. Consider using explicit CAST.
Fixed:
SELECT u.id FROM users u JOIN orders o ON o.user_id = u.id;
Notes
The same mismatch outside a JOIN condition is reported as E0003.
Configuring
# sqlsift.toml
[rules]
join-type-mismatch = "warn" # or "off"
Or for a single line: -- sqlsift:disable E0007. The examples use the schema on the Rules page.