An unknown type usually occurs when you have a string literal, and Postgres ends up trying to decide if it is a varchar, text, literal array, etc.
Change the line if necessary, for example:
'2'::int
Or do not quote it first, if applicable.
source
share