PostgreSQL current_query() Function

The PostgreSQL current_query() function returns one or more executing statements submitted by the current client.

current_query() Syntax

Here is the syntax of the PostgreSQL current_query() function:

current_query() -> TEXT

Parameters

The PostgreSQL current_query() function does not require any parameters.

Return value

The PostgreSQL current_query() function returns a string of text that is the current client submitted statement or statements being executed.

current_query() Examples

To get the current query statement, use the following SELECT statement with the current_query() function:

SELECT current_query();
      current_query
-------------------------
 SELECT current_query();