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

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.

主站蜘蛛池模板: 滦南县| 陆川县| 格尔木市| 池州市| 山阳县| 黄平县| 海丰县| 南澳县| 乐平市| 平南县| 余江县| 通城县| 沽源县| 轮台县| 临朐县| 顺昌县| 武功县| 海盐县| 洛阳市| 茶陵县| 泗水县| 连山| 五河县| 阳曲县| 沭阳县| 汝南县| 嘉定区| 南宁市| 新乐市| 察雅县| 古浪县| 江阴市| 南部县| 望都县| 凤山市| 商南县| 静宁县| 额尔古纳市| 黔江区| 三穗县| 兴宁市|