mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-04 06:47:19 +02:00
This provides a mechanism for specifying conversions between SQL data types and procedural languages. As examples, there are transforms for hstore and ltree for PL/Perl and PL/Python. reviews by Pavel Stěhule and Andres Freund
18 lines
481 B
SQL
18 lines
481 B
SQL
-- make sure the prerequisite libraries are loaded
|
|
DO '' LANGUAGE plperl;
|
|
SELECT NULL::hstore;
|
|
|
|
|
|
CREATE FUNCTION hstore_to_plperl(val internal) RETURNS internal
|
|
LANGUAGE C STRICT IMMUTABLE
|
|
AS 'MODULE_PATHNAME';
|
|
|
|
CREATE FUNCTION plperl_to_hstore(val internal) RETURNS hstore
|
|
LANGUAGE C STRICT IMMUTABLE
|
|
AS 'MODULE_PATHNAME';
|
|
|
|
CREATE TRANSFORM FOR hstore LANGUAGE plperl (
|
|
FROM SQL WITH FUNCTION hstore_to_plperl(internal),
|
|
TO SQL WITH FUNCTION plperl_to_hstore(internal)
|
|
);
|