简体   繁体   中英

Call a Windows shell command from pl/pgsql

In psql one can call the windows shell with '\\! [windows shell command]', but I cannot find the equivalent functionality for pl/pgsql .

The only possibility is to write and compile a C function that accesses the windows shell.

This only makes sense for a local db installation, for sure; pl/pgsql code is executed on the server not the client, but in this case both run on the same pc.

I need to execute a Python function, but I'd rather not load the postgres python language extension for just this one .py script.

You cannot do it in plpgsql. This language is "secure" language - that means, so nobody can access any system sources - IO, system functions, ..

When you need to use system sources, then you should to use some "untrusted" language like PLPerlu or PLPythonu. These languages are unsecure - without limited access to system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM