bool_plperlu

bool_plperlu

plperlu : transform between bool and plperlu

Overview

ID Extension Package Version Category License Language
3271
bool_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
plperlu
See Also
plperl
bool_plperl
plpgsql
pg_tle
plv8
Siblings
plperlu
jsonb_plperlu
hstore_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 bool_plperlu CASCADE; -- requires plperlu

Usage

bool_plperlu: Transform between bool and PL/Perl untrusted

Provides a transform for the bool type for PL/Perl Untrusted. When loaded, PostgreSQL boolean values are automatically converted to Perl native boolean representations and vice versa, instead of being passed as strings.

CREATE EXTENSION bool_plperlu;

CREATE FUNCTION check_flag_u(val boolean) RETURNS text
LANGUAGE plperlu TRANSFORM FOR TYPE boolean AS $$
  # val is a native Perl boolean (1 or undef), not a string
  if ($_[0]) {
    return "flag is set";
  }
  return "flag is not set";
$$;

SELECT check_flag_u(true);   -- flag is set
SELECT check_flag_u(false);  -- flag is not set
Last updated on