mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
config
contrib
adminpack
amcheck
auth_delay
auto_explain
bloom
btree_gin
btree_gist
citext
cube
dblink
dict_int
dict_xsyn
earthdistance
file_fdw
fuzzystrmatch
hstore
hstore_plperl
hstore_plpython
intagg
intarray
isn
jsonb_plperl
jsonb_plpython
expected
sql
.gitignore
Makefile
jsonb_plpython.c
jsonb_plpython2u--1.0.sql
jsonb_plpython2u.control
jsonb_plpython3u--1.0.sql
jsonb_plpython3u.control
jsonb_plpythonu--1.0.sql
jsonb_plpythonu.control
lo
ltree
ltree_plpython
oid2name
pageinspect
passwordcheck
pg_buffercache
pg_freespacemap
pg_prewarm
pg_standby
pg_stat_statements
pg_trgm
pg_visibility
pgcrypto
pgrowlocks
pgstattuple
postgres_fdw
seg
sepgsql
spi
sslinfo
start-scripts
tablefunc
tcn
test_decoding
tsm_system_rows
tsm_system_time
unaccent
uuid-ossp
vacuumlo
xml2
Makefile
README
contrib-global.mk
doc
src
.dir-locals.el
.gitattributes
.gitignore
COPYRIGHT
GNUmakefile.in
HISTORY
Makefile
README
README.git
aclocal.m4
configure
configure.in
Add a new contrib module jsonb_plpython that provide a transform between jsonb and PL/Python. jsonb values are converted to appropriate Python types such as dicts and lists, and vice versa. Author: Anthony Bykov <a.bykov@postgrespro.ru> Reviewed-by: Aleksander Alekseev <a.alekseev@postgrespro.ru> Reviewed-by: Nikita Glukhov <n.gluhov@postgrespro.ru>
20 lines
732 B
SQL
20 lines
732 B
SQL
/* contrib/jsonb_plpython/jsonb_plpython2u--1.0.sql */
|
|
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
\echo Use "CREATE EXTENSION jsonb_plpython2u" to load this file. \quit
|
|
|
|
CREATE FUNCTION jsonb_to_plpython2(val internal) RETURNS internal
|
|
LANGUAGE C STRICT IMMUTABLE
|
|
AS 'MODULE_PATHNAME', 'jsonb_to_plpython';
|
|
|
|
CREATE FUNCTION plpython2_to_jsonb(val internal) RETURNS jsonb
|
|
LANGUAGE C STRICT IMMUTABLE
|
|
AS 'MODULE_PATHNAME', 'plpython_to_jsonb';
|
|
|
|
CREATE TRANSFORM FOR jsonb LANGUAGE plpython2u (
|
|
FROM SQL WITH FUNCTION jsonb_to_plpython2(internal),
|
|
TO SQL WITH FUNCTION plpython2_to_jsonb(internal)
|
|
);
|
|
|
|
COMMENT ON TRANSFORM FOR jsonb LANGUAGE plpython2u IS 'transform between jsonb and Python';
|