There is such a request:
select max (number::integer) from table where id = ? This is a text field (as it was originally decided to make for convenience, so it went). But here's a bad luck - if someone inserts a '-' or '/', '\', and so on, then of course the exception will be sent to ::integer .
How can you implement a query so that it is the maximum number of fields that do not contain these signs?