3

I am using an instance of Postgres on RDS and I am trying to run:

=> create language plperlu;

but I get:

ERROR: must be superuser to create procedural language "plperlu"

If I run:

=> grant rds_superuser to treex;
NOTICE:  role "treex" is already a member of role "rds_superuser"
GRANT ROLE

Is it actually possible to use perl extensions for Postgres on RDS or the only solution is creating a Docker instance with Postgres and Perl modules preinstalled?

  • RDS has some languages already installed, but I doubt they will allow the untrusted version of PERL. This could compromise their systems. So, you'll have to install PostgreSQL on you own (virtual) machine (or Docker). – joanolo Jul 16 '17 at 11:00
4

You can't do this on RDS. The rds_superuser isn't a true superuser and cannot load any C-language extensions.

  • We should be cataloging every question tagged PostgreSQL that should be RDS. – Evan Carroll Jul 16 '17 at 16:46
  • @EvanCarroll I usually remember to add the rds tag, please do so too – Craig Ringer Jul 17 '17 at 1:19
1

RDS has some languages already installed, but they do not allow you to install any package which isn't already there.

From the RDS documentation on Extensions for PostgreSQL 9.6:

The following table shows PostgreSQL extensions for PostgreSQL version 9.6.x that are currently supported by PostgreSQL on Amazon RDS. "N/A" indicates that the extension is not available for that PostgreSQL version. [...]

[...]
plls      1.5.3   
plperl    1.0       
plpgsql
[...]
postgres_fdw
[...]

PLPERLu is not in the list.

They won't let you install the untrusted version of PERL. This could compromise their systems.


(Untested) workaround

So, if you really need this feature, you'll have to install PostgreSQL on you own (virtual) machine (or Docker), and use it there.

You can profit from PLPERLu in your box from RDS via some trickery with PostgreSQL FDW and triggers

  1. Setup your main (constrained) database at RDS.
  2. Setup your aux (unconstrained) database at your own box...
  3. Link the two together using postgres_fdw from main to aux.
  4. You cannot call directly a function via FDW. But you can have one table with an INSERT or UPDATE TRIGGER that performs the function call you're interested. This table could have a structure (parameter1, parameter2, ... , parameterN, result), and the trigger could be fired when you INSERT or UPDATE, to generate the column new.result.

NOTES:

  1. I've never tried this.
  2. I don't know which connectivity restrictions does RDS put to postgres_fdw or other data wrappers. They may restrict which are the permitted connection IP addresses, and this might make RDS unable to reach your aux database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.