hstore_plperl

transform between hstore and plperl

Overview

PackageVersionCategoryLicenseLanguage
plperl1.0LANGPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
3260plperlNoYesNoYesNoNo-
3261bool_plperlNoYesNoYesNoNo-
3262hstore_plperlNoYesNoYesNoNo-
3263jsonb_plperlNoNoNoYesNoNo-
Relatedplperl hstore_pllua hstore_plluau hstore_plperlu hstore_plpython3u hstore plperlu plpgsql

Version

PG18PG17PG16PG15PG14
1.01.01.01.01.0

Install

Note: This is a built-in contrib extension of PostgreSQL

CREATE EXTENSION hstore_plperl;

Usage

hstore_plperl: Transform between hstore and PL/Perl

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

CREATE EXTENSION hstore_plperl;

CREATE FUNCTION hstore_to_text(val hstore) RETURNS text
LANGUAGE plperl TRANSFORM FOR TYPE hstore AS $$
  # val is now a Perl hash reference
  my $result = '';
  for my $key (sort keys %$val) {
    $result .= "$key => $val->{$key}\n";
  }
  return $result;
$$;

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

SELECT hstore_to_text('a=>1, b=>2'::hstore);
SELECT make_hstore('color', 'blue');

Last Modified 2026-03-12: add pg extension catalog (95749bf)