select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / XML FUNCTIONS

The xmltable expression produces a table based on an XML value, an XPath filter to extract rows, and a set of column definitions.

Signatures & examples

XMLTABLE ( [XMLNAMESPACES ( namespace_uri AS namespace_name [, ...] ), ] row_expression PASSING [BY {REF|VALUE}] document_expression [BY {REF|VALUE}] COLUMNS name { type [PATH column_expression] [DEFAULT default_expression] [NOT NULL | NULL] | FOR ORDINALITY } [, ...] ) → setof record
The xmltable expression produces a table based on an XML value, an XPath filter to extract rows, and a set of column definitions. Although it syntactically resembles a function, it can only appear as a table in a query's FROM clause.
Version history 3
  1. PG 12 → 13changed
  2. PG 11 → 12changed
  3. PG 9.6 → 10added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source