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';
).
相关问题
- $ENV{$variable} in perl
- Django distinct is not working
- PostgreSQL: left outer join syntax
- Connecting Python to a Heroku PostgreSQL DB?
- PostgreSQL - Deleting data that are older than an
相关文章
- postgresql 关于使用between and 中是字符串的问题
- postgresql 月份差计算问题
- Using boolean expression in order by clause
- Table valued Parameter Equivalent in Postgresql
- in redshift postgresql can I skip columns with the
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- Running a perl script on windows without extension
- Comparing speed of non-matching regexp
Not when using PL/Perl. It restricts the use of require and use, so you cannot import modules. However, you can install PL/Perlu (for unrestricted mode) which allows you to load modules.
plperlu can be considered a security risk, however, as it also allows filesystem commands such as open.
For security purposes you cannot run a use/require statement within a function under plperl, but you can under plperlu.
IF you want to use modules in a secure way, you can add
plperl.on_init = 'require "myperlinit.pl";'
to thepostgresql.conf
file, then create a perl script called myperlinit.pl in the data directory which contains your uses. This will require a restart of the database server and these modules are available to all of your functions.If you want strict mode turned on, you can
plperl.use_strict = true
will add it.Note: this script is executed once per connection when the first perl function is called, and not when the connection is created.