官术网_书友最值得收藏!

Supported languages

While functions and procedures can be written in plain SQL, we are not likely to end up using this in our day-to-day development. More often, we will write functions and procedures in a much richer language with support for iterations, conditionals, and other constructs to provide a better control flow. PostgreSQL comes with a language named PL/pgSQL that enhances plain SQL with control flow predicates, and is often used as the default language for the implementation of functions and procedures.

Nevertheless, as already stated, PostgreSQL supports other external languages as well. In particular, it can handle Perl 5, Python, and TCL code via built-in languages called plperl, plpythonu, and pltcl, as well as the language PostgreSQL is built on, C. Other languages can be installed and used in addition, including Java (by means of pljava), Ruby, and Bash.

PostgreSQL is written in the C language and, of course, does support it as an external language to build functions and procedures. However, using C is often harder than other languages because it requires a good understanding of PostgreSQL internals.

Usually, all external languages comes in two forms: a trusted and an untrusted version. The trusted language imposes strict constraints on the execution context, not allowing, for instance, the loading of external resources (such as modules, libraries, or files) or network connectivity (such as socket interaction). On the other hand, untrusted languages allow the code to execute whatever the language allows it to do and, for this reason, can only be managed by database superusers.

主站蜘蛛池模板: 类乌齐县| 星子县| 南昌县| 罗江县| 航空| 通河县| 马鞍山市| 桐柏县| 九寨沟县| 阿拉尔市| 安西县| 汉源县| 阳西县| 中山市| 寿宁县| 绍兴县| 巴中市| 江永县| 扶余县| 疏勒县| 麻江县| 利川市| 宝兴县| 林口县| 唐山市| 新田县| 沙田区| 淮北市| 边坝县| 青冈县| 岑溪市| 喀喇沁旗| 康马县| 岫岩| 仙游县| 城口县| 大洼县| 石狮市| 永定县| 太康县| 屏山县|