The column's type decides the comparison rules, not the values' looks. Text ordering is character-by-character, so '1…' anything precedes '2'; text MAX crowns '9'. Meanwhile equality with a numeric literal can coerce and 'work', which is how text/int keys join for months before a non-numeric value appears and the cast explodes. Fix the type at the source; until then cast explicitly and visibly at every comparison.
SELECT slip FROM slips ORDER BY slip ;
SELECT slip FROM slips ORDER BY CAST(slip AS INT);
The slip numbers are text, so ORDER BY sorted them character-by-character — '10' and '100' came before '2', and MAX would crown '9' instead of the real highest slip.
Fix the schema, or write CAST(slip AS INT) out where the debt lives.
DuckDB and Postgres error on text_col > 5; looser engines coerce silently — the errorless version is the dangerous one.