mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
cac7658205
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)
|
|
);
|