Overview
The pg_typeof() is a system catalog information function that retrieves the data type of any given value. It returns a string literal corresponding to the expression type.Syntax
The syntax of thepg_typeof()
function is as follows:
Parameters
The following parameters are required to execute this function:any
: represents any value you want to determine the data type of
Examples
Numeric
This example shows the function usage with a numeric value:String
In this example, we will use a string value as an input:Interval
Here we will focus on using an interval input:Table
For the needs of this section we will create a sample table and then usepg_typeof()
to retrieve the data types of information stored in the table
pg_typeof()
function to determine the data types of the event_time and description columns for each row