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

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.

主站蜘蛛池模板: 江津市| 安远县| 安达市| 永靖县| 中方县| 陆川县| 收藏| 营山县| 瑞安市| 拉萨市| 金门县| 蓬安县| 邛崃市| 河东区| 新巴尔虎左旗| 格尔木市| 山西省| 商河县| 东乌| 高邮市| 彭泽县| 保靖县| 大理市| 波密县| 望谟县| 黎平县| 大埔县| 吉首市| 教育| 南昌市| 肥乡县| 龙州县| 桐乡市| 肥西县| 尼玛县| 太原市| 济南市| 永昌县| 青田县| 始兴县| 油尖旺区|