hstore_plpython3u

transform between hstore and plpython3u

Overview

PackageVersionCategoryLicenseLanguage
plpython3u1.0LANGPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
3290plpython3uNoYesNoYesNoNopg_catalog
3291jsonb_plpython3uNoNoNoYesNoYes-
3292ltree_plpython3uNoYesNoYesNoYes-
3293hstore_plpython3uNoNoNoYesNoYes-
Relatedhstore plpython3u hstore_pllua hstore_plluau hstore_plperl hstore_plperlu faker plpgsql

Version

PG18PG17PG16PG15PG14
1.01.01.01.01.0

Install

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

CREATE EXTENSION hstore_plpython3u;

Usage

hstore_plpython3u: Transform between hstore and PL/Python3

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

CREATE EXTENSION hstore_plpython3u;

CREATE FUNCTION hstore_to_pairs(val hstore) RETURNS text
LANGUAGE plpython3u TRANSFORM FOR TYPE hstore AS $$
  # val is now a Python dict
  return ', '.join(f'{k}={v}' for k, v in sorted(val.items()))
$$;

CREATE FUNCTION make_hstore(key text, value text) RETURNS hstore
LANGUAGE plpython3u TRANSFORM FOR TYPE hstore AS $$
  return {key: value}
$$;

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

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