Transform

A function specifying how to convert a native SQL data type to a procedural language's native variable type

A transform is a function specifying how to convert a native SQL data type to a procedural language's native variable type.

By default, any SQL data type passed to a procedural language is converted that language's text representation, however particularly with more complex data types such as hstore or JSON it's often desirable to convert it to a more appropriate representation such as an associative array, hash, dictionary, llst etc..

Transform functionality was added in PostgreSQL 9.5 (commit cac76582).

Implementation

Transforms are created using CREATE TRANSFORM, which creates a corresponding entry in the pg_transform system catalogue table. and Normally transform creation will be handled by an extension providing transforms for a particular procedural language.

Transforms are removed using DROP TRANSFORM, though this will normally be executed transparently as part of a DROP EXTENSION operation.

Extensions providing transforms

As of PostgreSQL 12, following contrib modules provide transforms:

Categories

Procedural language

See also

CREATE TRANSFORM, DROP TRANSFORM, pg_transform