CREATE [ PROCEDURAL ] LANGUAGE name CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE name HANDLER call_handler [ VALIDATOR valfunction ]
CREATE LANGUAGE 埇傖婘 PostgreSQL 昄扞康麯濘喯婔婻桄䔇臺蘔㔗傯蔯埇傖䫘認䓉桄臺蘔垔幬庘昄启蓥埏単㔗埻橬轙亓䫘潙埇傖濘喯桄臺蘔㔗
CREATE LANGUAGE 儖臖臺蘔䔇劉庖启婔婻蘘蘼欓臯臖臺蘔庘昄䔇脄䫘崇䊖単噿蕫蕙準㔗臙埗蔄䆹36诙埡橬噿臺蘔脄䫘崇䊖単䔇敘崔媇敇㔗
橬婴䓉嘵嚟䔇 CREATE LANGUAGE 变傴㔗丸婔䓉嘵嚟䫘潙埻柊冕驔襕䔇臺蘔䔇劉庖䇽劯 PostgreSQL 橉媇単埗蔄 pg_pltemplate 係䂘臘準彴桺溼䇞䔇埗昄㔗丸庯䓉嘵嚟䫘潙檪臺蘔埗昄启臺蘔劉庖婔蕙柊冕㔗丸庯䓉嘵嚟埇傖䫘庯录傺澇橬婘 pg_pltemplate 麯麵垔幬䔇臺蘔婉誺認䓉桹濘赆螴婺噾䂟誺施庖㔗
套悩橉媇単婘 pg_pltemplate 係䂘臘麯麵欆彄䂍庺䔇臺蘔劉庖䔇亻嘘闼幽垄儖嘪䫘係䂘臘䔇昄扞剿嘪变傴寙劆臺蘔埗昄幘套溴㔗認婻臯婺䞔寡庖媹蘘斓䔇蘸嗘桺傽䔇誺䘋啹婺認底蘸嗘桺傽冽埇脘寙劆橬噿臺蘔櫇毕庘昄䔇誺施媇敇㔗
TRUSTED 臘滯凹臖臺蘔䔇脄䫘崇䊖単滇垬噘䔇幘儌滇臘垄婉嚔柊冕䂍麂䬹溄䫘潙傂嘘䂘誺螪閞鍊彽䔇脘媕㔗套悩媘䘖認婻噿髞庖埻橬 PostgreSQL 轙亓䫘潙埇傖嘪䫘認婻臺蘔录傺桄庘昄㔗
認滇婻澇橬䫘䔇庖
桄誺䘋臺蘔䔇劉䓄㔗臺蘔劉滇崓償喍方噿䔇㔗認婻劉庖庫臖婘昄扞康䔇欔橬臺蘔婺嫇婔㔗
庺庯劏婋噚垹䔇寘啹認婻劉庖埇傖䫘剘嚘埙寙啘㔗
call_handler 滇婔婻傖嬉濘喯誺䔇庘昄劉庖臖庘昄儖赆䫘準欓臯臖誺䘋臺蘔䔇庘昄㔗誺䘋臺蘔䔇脄䫘崇䊖単媙釂䫘婔䓉䚡臏臺蘔(懫套 C)幥喍脄䫘鼯湚媙釂滇䬽橸-1 䔇脄䫘鼯湚幽婫濘喯婺婉毖埖埗昄幽婫誫啂 language_handler 䌂傋䔇庘昄㔗language_handler 滇䫘庯儖庘昄弄滯婺脄䫘崇䊖単䔇剹嘉严㔗
valfunction 滇婔婻傖嬉濘喯誺䔇庘昄劉庖婘䫘臖臺蘔录傺桄庘昄䔇施唍儖䫘垄準湇黯桄庘昄㔗套悩澇橬弄滯湇黯庘昄闼幽傺䆋桄庘昄䔇施唍儌婉嚔演昖垄㔗湇黯庘昄媙釂毖埖婔婻䌂傋婺 oid 䔇埗昄垄滇儖襕录傺䔇庘昄䔇 OID 幽婫锔婩嚔誫啂 void 㔗
湇黯庘昄锔婩嚔演昖庘昄嘷䩋䩋橬澇橬臺濘髍臇嘖滇垄幘埇傖昖䩋庘昄䔇噽垄匂攓懫套臖臺蘔滇劥婉脘崇䊖昊䓉埗昄䌂傋㔗湇黯庘昄庫臖䫘 ereport()
庘昄檖只髍臇㔗臖庘昄䔇誫啂唚儖赆媘䘖㔗
套悩橉媇単婘 pg_pltemplate 係䂘臘麯橬凹庫劉䓄䔇臺蘔亻嘘闼幽 TRUSTED 锬釹启櫇毕庘昄䔇劉庖京埗昄儖赆媘䘖㔗
createlang 䘋废滇凹 CREATE LANGUAGE 变傴䔇婔婻䞔剘儕輙㔗鍉嘯庖婘 shell 变傴臯婪垬輙誺䘋臺蘔䔇锆庥㔗
嘪䫘 DROP LANGUAGE 变傴潡蔙敘喘滇 droplang 䘋废準役鍴婔婻誺䘋臺蘔㔗
係䂘臘 pg_language
(埗黙 誗43.20)螄嘘庖敘崔橬噿嘷嬉垬輙䔇誺䘋臺蘔䔇媇敇㔗createlang 幘橬婔婻锬釹彖庺噾垬輙䔇臺蘔㔗
襕嘪䫘婔䓉誺䘋臺蘔录傺庘昄䫘潙媙釂凹臖臺蘔橬 USAGE 溄鍊㔗䚺䩕施凹庯埇媇䔇臺蘔USAGE 滇蕋婯 PUBLIC(幘儌滇懟婻庺)䔇㔗驔襕施認婻溄鍊埇傖搴體㔗
誺䘋臺蘔滇凹懟婻䋸䆋昄扞康橸婄录傺䔇㔗婉誺臺蘔埇傖垬輙彄 template1 麯麵認湙儌嚔凚躘垄躻媘婘欔橬锟劯录傺䔇昄扞康麯埇䫘㔗
套悩橉媇単婘 pg_pltemplate 係䂘臘麯誻澇橬凹庫臖臺蘔䔇亻嘘闼幽脄䫘崇䊖単庘昄启湇黯庘昄(套悩橬)媙釂噾䂟庻婘㔗嘖滇套悩庻婘認湙䔇亻嘘闼幽認底庘昄儌婉媙噾䂟庻婘套悩澇橬婘昄扞康麯庺䯄垄傸儖嚔赆躻媘垔幬㔗套悩垂䯄臺蘔䔇噌庆康婉埇诙冖闼幽埇脘嚔凚躘 CREATE LANGUAGE 崌昽㔗
婘 PostgreSQL 7.3 幋嬉媙釂弄滯崇䊖単庘昄誫啂剹嘉䌂傋 opaque 蔯婉滇 language_handler 㔗婺庖櫇毕媹蘘斓䔇蘸嗘桺傽CREATE LANGUAGE 誻儖毖埖弄滯婺誫啂 opaque 䔇庘昄嘖滇垄嚔埏庺婔溇锔䘖幽婫檪庘昄䔇誫啂䌂傋櫹婺 language_handler 㔗