3 ms·
My favorite relatively obscure pg feature is you can write stored procedures in perl, python, and tcl.
by jeffbee 5y ago
My favorite relatively obscure pg feature is you can write stored procedures in perl, python, and tcl.
- mindcrime 5y agoNot to mention Java, R, Ruby, PHP, Scheme, and sh. https://www.postgresql.org/docs/9.5/external-pl.html https://www.postgresql.org/docs/9.5/external-pl.html Heck, there's even a pl/prolog out there, but it looks pretty old and I'm skeptical how useful it would be. https://github.com/salva/plswipl https://github.com/salva/plswipl
- brasetvik 5y agoThey're cool, but keep in mind that this often means you cannot run them on managed Postgres services.
- pageandrew 5y agoWow, I've been writing a lot of PL/pgSQL recently and did not know this. Would these be drop in replacements for PL/pgSQL? Are there any performance tradeoffs to using one over another? Any changes in functionality (aka functions you can call)?
- jeffbee 5y agoI personally have never run into whatever the limitations might be of pl/python, but I suppose you could make a disaster by trying to dynamically load conflicting symbols or something like that. But I have used numpy in stored procedures, so at least that works. pl/sh also works wonderfully if you want to run a complex procedure in an isolated subprocess, but pl/sh is not part of the main postgresql distribution.