# pg_typeof

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: pg_typeof
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/sql-functions/other-functions/pg-typeof
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-functions/other-functions/pg-typeof.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/other-functions/pg-typeof.adoc
description: The pg_typeof() function retrieves the data type of any given value.
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-functions/other-functions/pg-typeof.md -->

The [`pg_typeof()`](https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-CATALOG) 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)Syntax

```sql
SELECT pg_typeof(`any`);
```

## [](#parameters)Parameters

-   `any`: Represents any value used to determine the data type.


## [](#examples)Examples

### [](#numeric)Numeric

This example shows the function usage with a numeric value:

```sql
SELECT pg_typeof(100) as "data type";
```

```sql
 data type
-----------
 integer
```

### [](#string)String

This example uses a string value as an input:

```sql
SELECT pg_typeof('event'::TEXT) as "data type";
```

```sql
 data type
-----------
 text
```

### [](#interval)Interval

This example uses an interval input:

```sql
SELECT pg_typeof(INTERVAL '1 day') as "data type";
```

```sql
 data type
-----------
 interval
```

### [](#table)Table

This section shows how to create a sample table and then uses `pg_typeof()` to retrieve the data types of information stored in the table:

```sql
CREATE TABLE timestamp_example (
    id int,
    event_time timestamp,
    description text
);

INSERT INTO timestamp_example (event_time, description)
VALUES
  ('2023-10-20 12:30:00', 'Event 1'),
  (NULL, 'Event 2');
```

Use the `pg_typeof()` function to determine the data types of the `event_time` and `description` columns for each row:

```sql
SELECT
    pg_typeof(event_time) AS event_time_type,
    pg_typeof(description) AS description_type
FROM timestamp_example;
```

The query returns:

```sql
       event_time_type       | description_type
-----------------------------+------------------
 timestamp without time zone | text
 timestamp without time zone | text
```