Snowflake's TRIM accepts any type and returns VARCHAR, docs does not mentioned it but it seems to only works on VARCHAR/TEXT typed inputs and acts as a cast to VARCHAR for others. DuckDB's TRIM only accepts VARCHAR. It seemed safe to me to cast input to VARCHAR to mimic similar behaviour.
select
trim(5) as c_number, SYSTEM$TYPEOF(c_number),
trim(' str ') as c_varchar, SYSTEM$TYPEOF(c_varchar),
trim(to_variant({'k': 'v'})) as c_variant, SYSTEM$TYPEOF(c_variant)
;
Snowflake's
TRIM
accepts any type and returns VARCHAR, docs does not mentioned it but it seems to only works on VARCHAR/TEXT typed inputs and acts as a cast to VARCHAR for others. DuckDB'sTRIM
only accepts VARCHAR. It seemed safe to me to cast input to VARCHAR to mimic similar behaviour.