hstore_plperlu

hstore_plperlu

plperlu : transform between hstore and plperlu

Overview

ID Extension Package Version Category License Language
3273
hstore_plperlu
plperlu
1.0
LANG
PostgreSQL
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
----d--
No
No
No
Yes
no
no
Relationships
Requires
hstore
plperlu
See Also
hstore_pllua
hstore_plluau
hstore_plperl
hstore_plpython3u
hstore
plperl
plpgsql
Siblings
plperlu
bool_plperlu
jsonb_plperlu

Packages

PG18 PG17 PG16 PG15 PG14
1.0
1.0
1.0
1.0
1.0

This is a built-in contrib extension ship with the PostgreSQL kernel

Install

Create this extension with:

CREATE EXTENSION hstore_plperlu CASCADE; -- requires hstore, plperlu

Usage

hstore_plperlu: Transform between hstore and PL/Perl untrusted

Provides a transform for the hstore type for PL/Perl Untrusted. When loaded, hstore values are automatically converted to Perl hashes and vice versa.

CREATE EXTENSION hstore_plperlu;

CREATE FUNCTION hstore_to_json_u(val hstore) RETURNS text
LANGUAGE plperlu TRANSFORM FOR TYPE hstore AS $$
  use JSON;
  # val is now a Perl hash reference
  return encode_json($val);
$$;

CREATE FUNCTION make_hstore_u(key text, value text) RETURNS hstore
LANGUAGE plperlu TRANSFORM FOR TYPE hstore AS $$
  my ($k, $v) = @_;
  return { $k => $v };
$$;

SELECT hstore_to_json_u('a=>1, b=>2'::hstore);
SELECT make_hstore_u('color', 'blue');
Last updated on