简体   繁体   English

从pl / pgsql调用Windows Shell命令

[英]Call a Windows shell command from pl/pgsql

In psql one can call the windows shell with '\\! psql中,可以使用'\\! 调用Windows Shell [windows shell command]', but I cannot find the equivalent functionality for pl/pgsql . [windows shell命令]”,但是找不到pl / pgsql的等效功能。

The only possibility is to write and compile a C function that accesses the windows shell. 唯一的可能性是编写和编译访问Windows Shell的C函数。

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. pl / pgsql代码在服务器而不是客户端上执行,但是在这种情况下,两者都在同一台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. 我需要执行一个Python函数,但是我不想只为这个.py脚本加载postgres python语言扩展。

You cannot do it in plpgsql. 您不能在plpgsql中执行此操作。 This language is "secure" language - that means, so nobody can access any system sources - IO, system functions, .. 此语言是“安全”语言-表示没有人可以访问任何系统源-IO,系统功能等。

When you need to use system sources, then you should to use some "untrusted" language like PLPerlu or PLPythonu. 当您需要使用系统源代码时,则应使用某些“不受信任”的语言,例如PLPerlu或PLPythonu。 These languages are unsecure - without limited access to system. 这些语言是不安全的-没有对系统的有限访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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