diff --git a/contrib/Makefile b/contrib/Makefile index 92184ed487..795f69cf64 100644 --- a/contrib/Makefile +++ b/contrib/Makefile @@ -75,9 +75,9 @@ ALWAYS_SUBDIRS += sepgsql endif ifeq ($(with_perl),yes) -SUBDIRS += hstore_plperl jsonb_plperl +SUBDIRS += hstore_plperl jsonb_plperl bool_plperl else -ALWAYS_SUBDIRS += hstore_plperl jsonb_plperl +ALWAYS_SUBDIRS += hstore_plperl jsonb_plperl bool_plperl endif ifeq ($(with_python),yes) diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml index e4769c0e38..79f781a4ce 100644 --- a/doc/src/sgml/plperl.sgml +++ b/doc/src/sgml/plperl.sgml @@ -55,7 +55,10 @@ syntax: -CREATE FUNCTION funcname (argument-types) RETURNS return-type AS $$ +CREATE FUNCTION funcname (argument-types) + RETURNS return-type + -- function attributes + AS $$ # PL/Perl function body $$ LANGUAGE plperl; @@ -347,6 +350,36 @@ SELECT * FROM perl_set(); + + By default, json and jsonb values are passed to + PL/Perl functions and procedures as text. For jsonb it is + possible to convert the values into internal Perl representation automatically + using the transforms, see and . + jsonb_plperl extension provides such transform for jsonb data type. + To enable the transform, create this extension and then specify + + TRANSFORM FOR TYPE jsonb + + in the CREATE FUNCTION statement. + + + + By default, boolean values are passed to plperl as text, namely 't' + for true and 'f' for false. + To transform these values into Perl true and false values, use the transform + provided by bool_plperl extension. + To enable the transform, create this extension and then specify + + TRANSFORM FOR TYPE bool + + in the CREATE FUNCTION statement. + + + + The above mentioned jsonb and bool transforms are applied for function arguments, + its return value and results of SPI database queries performed inside the function. + + If you wish to use the strict pragma with your code you have a few options. For temporary global use you can SET diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 834c2c39d1..809a2bab0d 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -43,6 +43,7 @@ my $contrib_extrasource = { 'seg' => [ 'contrib/seg/segscan.l', 'contrib/seg/segparse.y' ], }; my @contrib_excludes = ( + 'bool_plperl', 'commit_ts', 'hstore_plperl', 'hstore_plpython', 'intagg', 'jsonb_plperl', 'jsonb_plpython', @@ -763,6 +764,9 @@ sub mkvcbuild } # Add transform modules dependent on plperl + my $bool_plperl = AddTransformModule( + 'bool_plperl', 'contrib/bool_plperl', + 'plperl', 'src/pl/plperl'); my $hstore_plperl = AddTransformModule( 'hstore_plperl', 'contrib/hstore_plperl', 'plperl', 'src/pl/plperl', @@ -773,6 +777,7 @@ sub mkvcbuild foreach my $f (@perl_embed_ccflags) { + $bool_plperl->AddDefine($f); $hstore_plperl->AddDefine($f); $jsonb_plperl->AddDefine($f); }