Questions tagged [plperl]

plperl/plperlu A perl language extension for use within the PostgreSQL object relational database for creating user defined functions.

plperl and plperlu are procedural language extensions that can be used within the PostgreSQL object relational database for creating user-defined functions.

plperl uses a restricted subset of the full perl language functionality to enable a more security aware set of the perl language features for use within PostgreSQL.

plperlu is an less restrictive feature set of the perl language for use within PostgreSQL. plperlu allows the use of feature such as external modules and filesystem access. The use of plperlu should be carefully reviewed for security conscious environments.

38 questions
8
votes
2 answers

can you use libraries in PL/Perl

I'm just curious if when writing PL/Perl functions if I can have a use My::Lib; statement, or enable pragma's and features (e.g. 'use strict; use feature 'switch';).
xenoterracide
  • 16,274
  • 24
  • 118
  • 243
7
votes
4 answers

How to split a type into multiple columns in Postgres?

I have the following code to return multiple values from pl/python: CREATE TYPE named_value AS ( name text, value integer ); CREATE or replace FUNCTION make_pair (name text, value integer) RETURNS named_value AS $$ return [ name, value…
David
  • 4,786
  • 11
  • 52
  • 80
5
votes
3 answers

PostgreSQL error: language "plperlu" does not exist

I am a beginner with PostgreSQL. I got a SQL patch of PostgreSQL and while executing the SQL to configure it at my end. I am getting following error. My background is MySQL. Query CREATE FUNCTION wine_entry_script() RETURNS trigger LANGUAGE…
Aakash
  • 53
  • 1
  • 1
  • 4
5
votes
1 answer

Debugging PL/Python functions

I just practiced some happy engineering and wrote lots of code without testing each step as I usually do. So now I have a few hundred lines of code with an error somewhere... I am using pgAdmin III to write the Python and I write it in their Query…
David
  • 4,786
  • 11
  • 52
  • 80
5
votes
2 answers

Why does this postgres stored procedure want to `use utf8`?

I have come across a peculiarity in a plperl stored procedure on Postgres 9.2 with Perl 5.12.4. The curious behavior can be reproduced using this "broken" SP: CREATE FUNCTION foo(VARCHAR) RETURNS VARCHAR AS $$ my ( $re ) = @_; $re =…
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
5
votes
3 answers

Postgresql - how to disallow use of spaces in some string fields

I want to disallow the use of spaces in some text/varchar fields. Even more, it would be best to have only a set of characters that are allowed to use there, like: [a-zA-Z0-9_\-] And I want to make it as a rule to all VARCHAR fields that are…
kender
  • 85,663
  • 26
  • 103
  • 145
4
votes
3 answers

Has anyone gotten plperl to work with Postgres 9.1 on Windows?

I've been unable to get plperl to work with Postgres 9.1 on Windows. The same problem is described here, but with no solution so far: http://postgresql.1045698.n5.nabble.com/BUG-6204-Using-plperl-functions-generate-crash-td4802111.html REPRO Install…
user728066
  • 41
  • 1
  • 2
4
votes
3 answers

IP address stored as decimal - PL/SQL to display as dotted quad

We have an Oracle database that contains IP addresses stored as decimal integers - this is incredibly painful when manipulating the data by hand instead of via the web interface, yet hand manipulation is really handy as the network guys continually…
Jason Tan
  • 449
  • 1
  • 3
  • 8
3
votes
1 answer

Does PostgreSQL keep its pl* interpreters loaded persistently?

If I wrote something in plperlu, when would that module be reloaded? Every time the function ran? The first time it ran? Does the Perl DLL get unloaded if it hasn't been used in a while, and then after that it'd be another module reload?
Kev
  • 15,899
  • 15
  • 79
  • 112
3
votes
1 answer

Call command-line function in Perl and get output as String

What is the best/easiest way to execute a command line function in Perl, such that I can get the output as a String? What I'm actually trying to do is call a Java program from within a PL/Perl function in PostgreSQL, and I want the output String,…
Larry
  • 11,439
  • 15
  • 61
  • 84
2
votes
1 answer

PostgreSQL PL/PerlU trigger issue

I'm trying to create a PostgreSQL trigger on Linux written in Perl which should execute code based on external libraries. The SQL script containing the trigger looks like this: CREATE OR REPLACE FUNCTION notify_mytable_update() RETURNS trigger AS…
George R.
  • 311
  • 2
  • 11
2
votes
1 answer

PL/Perl trigger cannot use ENV variables defined in .bashrc

I'm trying to use an environment variable (for example HOME) inside a PL/perl trigger in postgresql and it appears to be empty. Running printenv | grep HOME in the terminal returns the desired path. I am defining the trigger as CREATE EXTENSION IF…
Bianca
  • 322
  • 1
  • 10
2
votes
1 answer

Perl/Postgresql: plperl.so undefined symbol: Perl_sv_2bool_flags

This is my first post on here so sorry if I don't provide all the information required first time round! My boss and I have been trying to install plperl on our postgres installation on one of our servers (Centos 6.5, Postgres 9.2.1, Perl 5.10.1)…
2
votes
1 answer

How can I call a PL/Perl function from another PL/Perl function?

CREATE FUNCTION foo() RETURNS text LANGUAGE plperl AS $$ return 'foo'; $$; CREATE FUNCTION foobar() RETURNS text LANGUAGE plperl AS $$ return foo() . 'bar'; $$; I'm trying to compose results using multiple…
maxxtack
  • 31
  • 1
2
votes
1 answer

PostgreSQL: character of encoding "UTF8" has no equivalent in "LATIN1" in plperl stored procedure

I have this stored procedure written in Pl/Perl: CREATE FUNCTION strip_html_tags(text) RETURNS TEXT AS $$ use HTML::Strip; my $hs = HTML::Strip->new(); my $clean_text = $hs->parse($_[0]); $hs->eof; return $clean_text; $$ LANGUAGE…
Gonçalo Marrafa
  • 2,013
  • 4
  • 27
  • 34
1
2 3