CREATE OPERATOR
This page documents the preview version (v2.21). Preview includes features under active development and is for development and testing only. For production, use the stable version (v2024.1). To learn more, see Versioning.
Synopsis
Use the CREATE OPERATOR
statement to create an operator.
Syntax
create_operator ::= CREATE OPERATOR operator_name (
{ FUNCTION = subprogram_name
| PROCEDURE = subprogram_name }
[ , operator_option [ ... ] ] )
operator_option ::= LEFTARG = left_type
| RIGHTARG = right_type
| COMMUTATOR = com_op
| NEGATOR = neg_op
| RESTRICT = res_proc
| JOIN = join_proc
| HASHES
| MERGES
Semantics
See the semantics of each option in the [PostgreSQL docs][postgresql-docs-create-operator].
Examples
Basic example.
yugabyte=# CREATE OPERATOR @#@ (
rightarg = int8,
procedure = numeric_fac
);
yugabyte=# SELECT @#@ 5;
?column?
----------
120