In PostgreSQL, you can use the funtion pg_typeof()
within the SELECT statement to get the data type of a value returned by a SQL query.
This function does not exist in Redshift, despite Redshift's SQL lineage.
I want to do this:
SELECT pg_typeof(0.25::numeric(5,2)) ;
and get:
numeric(5,2)
How do I get the data type of a value returned by a SQL query? This is to help me with unit-testing my ETL development.