hstore_plperl

一个 contrib 模块,为 PL/Perl 提供 hstore 转换

hstore_plperl 是一个 contrib 模块,它为 PL/Perlhstore 类型实现了转换,并(作为 hstore_plperlu)为 PL/PerlU 实现转换。

hstore_plperl 已在 PostgreSQL 9.5 中添加。

变更历史

示例

使用示例(使用非信任变体 hstore_plperlu 以便能够使用 Data::Dumper 模块)

postgres=# CREATE EXTENSION hstore_plperlu CASCADE;
NOTICE:  installing required extension "hstore"
NOTICE:  installing required extension "plperlu"

postgres=# CREATE FUNCTION hello_hstore(hstore)
             RETURNS TEXT
             TRANSFORM FOR TYPE hstore
             LANGUAGE plperlu
           AS $$
             my $params = shift;
           
             use Data::Dumper;
             elog(INFO, Dumper($params));
           
             $params->{message} //= 'world';
           
             return sprintf('hello %s', $params->{message});
           $$;
CREATE FUNCTION

postgres=# SELECT hello_hstore('message=>"universe"');
INFO:  $VAR1 = {
          'message' => 'universe'
        };

  hello_hstore  
----------------
 hello universe
(1 row)
  • PostgreSQL documentation: hstore

分类

Contrib 模块, 数据类型, 过程语言

另请参阅

hstore, hstore_plpython

反馈

提交有关“hstore_plperl”的任何评论、建议或更正 在此处