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

CREATE OPERATOR

劉䓄

CREATE OPERATOR -- 垔幬婔婻桄淉嘩严

臺濘

CREATE OPERATOR name (
    PROCEDURE = funcname
    [, LEFTARG = lefttype ] [, RIGHTARG = righttype ]
    [, COMMUTATOR = com_op ] [, NEGATOR = neg_op ]
    [, RESTRICT = res_proc ] [, JOIN = join_proc ]
    [, HASHES ] [, MERGES ]
    [, SORT1 = left_sort_op ] [, SORT2 = right_sort_op ]
    [, LTCMP = less_than_op ] [, GTCMP = greater_than_op ]
)

柟誄

CREATE OPERATOR 垔幬婔婻桄䔇 name 淉嘩严㔗垔幬臖淉嘩严䔇䫘潙儖潊婺噽欔橬蔙㔗套悩䂍庺庖婔婻昇嚟劉闼幽臖淉嘩严儖婘毺垔䔇昇嚟婺录傺㔗劥彍垄嚔婘嘷嬉昇嚟婺录傺㔗

淉嘩严 name 滇婔婻橔崔 NAMEDATALEN-1 阪䔇(䚺䩕婺 63 婻)婋彖庖严䂇潊䔇庖严婾

+ - * / < > = ~ ! @ # % ^ & | ` ?

嘹锬拷劉庖䔇施唍橬庹婻鍊彽

淉嘩严 != 婘膷噖施滹儇潊 <> 啹溴認婴婻劉䓄攂滇京備䔇㔗

躿儏驔襕垔幬婔婻 LEFTARGRIGHTARG 㔗凹庯埯䕞淉嘩严準臘婴蔙鄘驔襕垔幬㔗凹埿䕞淉嘩严準臘埻驔襕垔幬 LEFTARG 蔯凹庯噥䕞淉嘩严準臘埻驔襕垔幬 RIGHTARG

劯湙funcname 誺䘋媙釂噾䂟䫘 CREATE FUNCTION 垔幬誺蔯婫媙釂垔幬婺毖埖溼䇞昄麟䔇毺垔䌂傋埗昄(婔婻潡滇婴婻)㔗

噽垄床埖弄滯埇锬䔇淉嘩严嚻寡床埖㔗傡傸䔇劆幬婘誗33.13麯垔幬㔗

埗昄

name

襕垔幬䔇淉嘩严㔗埇䫘䔇庖严蓕婪桺㔗噽劉庖埇傖䫘昇嚟媞閄(懫套 CREATE OPERATOR myschema.+ (...))㔗套悩澇橬昇嚟彍婘嘷嬉昇嚟婺录傺淉嘩严㔗劯婔婻昇嚟婺䔇婴婻淉嘩严埇傖橬婔湙䔇劉庖埻襕傡傸淉嘩婉劯䔇昄扞䌂傋㔗認埆啔麉蘘

funcname

䫘庯垂䯄臖淉嘩严䔇庘昄

lefttype

淉嘩严噥膹䔇埗昄昄扞䌂傋套悩庻婘䔇臺㔗套悩滇噥䕞淉嘩严認婻埗昄埇傖䩕䘖㔗

righttype

淉嘩严埿膹䔇埗昄昄扞䌂傋套悩庻婘䔇臺㔗套悩滇埿䕞淉嘩严認婻埗昄埇傖䩕䘖㔗

com_op

臖淉嘩严凹庫䔇庴扵淉嘩严

neg_op

臖淉嘩严凹庫䔇蘘淉嘩严

res_proc

溴淉嘩严亥溘锬拷攓臇嚄庘昄

join_proc

溴淉嘩严誂毖锬拷攓臇嚄庘昄

HASHES

臘滯溴淉嘩严櫇毕 Hash 誂毖

MERGES

臘滯溴淉嘩严埇傖櫇毕婔婻肉劽誂毖

left_sort_op

溴淉嘩严䔇噥膹昄扞䔇毐废淉嘩严(套悩溴淉嘩严櫇毕肉劽誂毖)

right_sort_op

溴淉嘩严䔇埿膹昄扞䔇毐废淉嘩严(套悩溴淉嘩严櫇毕肉劽誂毖)

less_than_op

懫膄認婻淉嘩严䔇膷噖昄扞䌂傋䔇償庯淉嘩严(套悩溴淉嘩严櫇毕肉劽誂毖)

greater_than_op

懫膄認婻淉嘩严䔇膷噖昄扞䌂傋䔇崓庯淉嘩严(套悩溴淉嘩严櫇毕肉劽誂毖)

嘪䫘 OPERATOR() 臺濘婘 com_op 潡蔙噽垄埇锬埗昄麯䂍庺婔婻昇嚟媞閄䔇淉嘩严劉懫套

COMMUTATOR = OPERATOR(myschema.===) ,

濘懟

埗黙誗33.12婺䔇淉嘩严䆹誗诙埡敘崔媇敇㔗

嘪䫘 DROP OPERATOR 傯昄扞康婺役鍴䫘潙垔幬淉嘩严㔗嘪䫘 ALTER OPERATOR 媞櫹婔婻昄扞康麯䔇淉嘩严㔗

冋床

婋麵变傴垔幬婔婻桄淉嘩严麵䓇䕩京䫘庯 box 昄扞䌂傋㔗

CREATE OPERATOR === (
    LEFTARG = box,
    RIGHTARG = box,
    PROCEDURE = area_equal_procedure,
    COMMUTATOR = ===,
    NEGATOR = !==,
    RESTRICT = area_restriction_procedure,
    JOIN = area_join_procedure,
    HASHES,
    SORT1 = <<<,
    SORT2 = <<<
    -- 啹婺䂍庺庖毐废淉嘩严欔傖䘵嚘锊劆婄橬 MERGES 㔗
    -- LTCMP 启 GTCMP 彖彆啺螆滇 < 启 > 
);

噚垹攓

CREATE OPERATOR 滇 PostgreSQL 欷匘㔗SQL 湺庖婺澇橬臖臺埖㔗

埽蓕

ALTER OPERATOR, CREATE OPERATOR CLASS, DROP OPERATOR

劯锔饡釕嬉誕
CREATE LANGUAGE婪婔亓CREATE OPERATOR CLASS