CREATE OPERATOR

Synopsis

Use the CREATE OPERATOR statement to create a new operator.

Syntax

  1. create_operator ::= CREATE OPERATOR operator_name (
  2. { FUNCTION = function_name
  3. | PROCEDURE = procedure_name }
  4. [ , operator_option [ ... ] ] )
  5. operator_option ::= LEFTARG = left_type
  6. | RIGHTARG = right_type
  7. | COMMUTATOR = com_op
  8. | NEGATOR = neg_op
  9. | RESTRICT = res_proc
  10. | JOIN = join_proc
  11. | HASHES
  12. | MERGES

create_operator

CREATE OPERATOR - 图1

operator_option

CREATE OPERATOR - 图2

Semantics

See the semantics of each option in the [PostgreSQL docs][postgresql-docs-create-operator].

Examples

Basic example.

  1. yugabyte=# CREATE OPERATOR @#@ (
  2. rightarg = int8,
  3. procedure = numeric_fac
  4. );
  5. yugabyte=# SELECT @#@ 5;

  1. ?column?

  1. 120

See also