select ats.id, ap.value from akh_test_suit ats LEFT JOIN akh_properties ap on ap.ID = ats.test_suit_type_id where ats.ID = 472
id | value 472 | 472 ID -- integer value -- text select * from akh_test_suit ats LEFT JOIN akh_properties ap on ap.ID = ats.test_suit_type_id where ats.ID = 472 and ap.value::integer = ats.ID ERROR: invalid input syntax for integer: "--username sergeiz --password sergeiz --non-interactive svn://sergeiz" akh_properties.values has non numeric values, but those rows do not (MUST NOT) participate in results as showed in first query Why PG check them?