bool_plperl
transform between bool and plperl
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
plperl | 1.0 | LANG | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3260 | plperl | No | Yes | No | Yes | No | No | - |
| 3261 | bool_plperl | No | Yes | No | Yes | No | No | - |
| 3262 | hstore_plperl | No | Yes | No | Yes | No | No | - |
| 3263 | jsonb_plperl | No | No | No | Yes | No | No | - |
| Related | plperl plperlu bool_plperlu plpgsql pg_tle plv8 |
|---|
Version
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
| 1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
Install
Note: This is a built-in contrib extension of PostgreSQL
CREATE EXTENSION bool_plperl;
Usage
Provides a transform for the bool type for PL/Perl. 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_plperl;
CREATE FUNCTION check_flag(val boolean) RETURNS text
LANGUAGE plperl 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(true); -- flag is set
SELECT check_flag(false); -- flag is not set
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.