How to compare the data type of a query value in Postgresql How to compare the data type of a query result value? For example, to check if something is an 'interval'
select pg_typeof(current_timestamp - '2020-01-01 00:00') = 'interval';

gives the error
ERROR: invalid input syntax for type oid: &quot;interval&quot;
You need to convert the string 'interval'  to a type OID:
select pg_typeof(current_timestamp - '2020-01-01 00:00') = 'interval'::regtype;