PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔媆誕嬉誕

CREATE LANGUAGE

劉䓄

CREATE LANGUAGE -- 垔幬婔䓉桄誺䘋臺蘔

臺濘

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

TRUSTED 臘滯凹臖臺蘔䔇脄䫘崇䊖単滇垬噘䔇幘儌滇臘垄婉嚔柊冕䂍麂䬹溄䫘潙傂嘘䂘誺螪閞鍊彽䔇脘媕㔗套悩媘䘖認婻噿髞庖埻橬 PostgreSQL 轙亓䫘潙埇傖嘪䫘認婻臺蘔录傺桄庘昄㔗

PROCEDURAL

認滇婻澇橬䫘䔇庖

name

桄誺䘋臺蘔䔇劉䓄㔗臺蘔劉滇崓償喍方噿䔇㔗認婻劉庖庫臖婘昄扞康䔇欔橬臺蘔婺嫇婔㔗

庺庯劏婋噚垹䔇寘啹認婻劉庖埇傖䫘剘嚘埙寙啘㔗

HANDLER call_handler

call_handler 滇婔婻傖嬉濘喯誺䔇庘昄劉庖臖庘昄儖赆䫘準欓臯臖誺䘋臺蘔䔇庘昄㔗誺䘋臺蘔䔇脄䫘崇䊖単媙釂䫘婔䓉䚡臏臺蘔(懫套 C)幥喍脄䫘鼯湚媙釂滇䬽橸-1 䔇脄䫘鼯湚幽婫濘喯婺婉毖埖埗昄幽婫誫啂 language_handler 䌂傋䔇庘昄㔗language_handler 滇䫘庯儖庘昄弄滯婺脄䫘崇䊖単䔇剹嘉严㔗

VALIDATOR valfunction

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

冋床

录傺湺庖䔇誺䘋臺蘔䔇懫膄喘䔇桹濘

CREATE LANGUAGE plpgsql;

凹庯 pg_pltemplate 誻婉䘖長䔇臺蘔驔襕婋麵認湙䔇废彖

CREATE FUNCTION plsample_call_handler() RETURNS language_handler
    AS '$libdir/plsample'
    LANGUAGE C;
CREATE LANGUAGE plsample
    HANDLER plsample_call_handler;

噚垹攓

CREATE LANGUAGE 滇 PostgreSQL 欷匘

埽蓕

ALTER LANGUAGE, CREATE FUNCTION, DROP LANGUAGE, GRANT, REVOKE, createlang, droplang

劯锔饡釕嬉誕
CREATE INDEX婪婔亓CREATE OPERATOR