懟婻淉嘩严鄘滇凹䩘溼幾昂䔇凹庫庘昄䔇"臺幬媞閄"欔傖嘹婘录傺淉嘩严幋嬉媙釂噽录傺凹庫䔇庘昄㔗婉誺婔婻淉嘩严幘幽婉備備滇臺幬媞閄啹婺垄誻婥五埇傖婞媷昖臵蓇彐単嚻寡嘪䫘臖淉嘩严䔇鍇媹媇敇㔗婋婔誗儖䫘庯蓼麪認底鍇媹媇敇㔗
PostgreSQL 櫇毕噥䕞㔕埿䕞㔕埯䕞淉嘩严㔗淉嘩严埇傖麉蘘幘儌滇臘劯婔婻淉嘩严埇傖䫘庯婉劯昄䕞启䌂傋䔇淉嘩昄㔗婘欓臯婔婻昖臵䔇施唍係䂘傯劉庖启柊冕䔇淉嘩严䌂傋婪彴桺驔襕脄䫘巻婻淉嘩严㔗
婋麵滇婔婻录傺䫘庯婴婻崉昄䕩媹䔇淉嘩严䔇冋床㔗啺螆噾䂟录傺庖 complex(蓕誗33.11)䌂傋䔇垔幬㔗饡噽驔襕啔䕩媹噖嘩䔇庘昄䇽劯儌埇傖垔幬淉嘩严
CREATE FUNCTION complex_add(complex, complex) RETURNS complex AS 'filename', 'complex_add' LANGUAGE C IMMUTABLE STRICT; CREATE OPERATOR + ( leftarg = complex, rightarg = complex, procedure = complex_add, commutator = + );
䯄婘埇傖欓臯償婋麵認湙䔇昖臵
SELECT (a + b) AS c FROM test_complex; c ----------------- (5.2,6.05) (133.42,144.95)
婘認麯噾䂟暫䴺庖套嘘录傺埯䕞淉嘩严㔗襕录傺剘䕞淉嘩严埻驔襕䩕䘖 leftarg 潡蔙 rightarg 剿埇㔗埻橬 procedure 床埖启埗昄(argument)床埖滇 CREATE OPERATOR 麯驔襕䔇溇䕞㔗冋床麯暫䴺䔇 commutator 床埖滇婔婻䂍昖臵嚻寡単䔇埇锬攖䴺㔗噿庯 commutator 启噽垄嚻寡単柊䴺䔇臥䂖媇敇婘婋誗䂍庺㔗