Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

CREATE OPERATOR CLASS

Updated on 2024-05-07 GMT+08:00

Description

Defines a new operator class. This function is for internal use only. You are advised not to use it.

Precautions

  • CREATE OPERATOR CLASS defines a new operator class. An operator class defines how to use a specified data type together with an index. The operator class declares that certain operators will provide particular roles or "strategies" for this data type and this index method. The operator class also declares the supported programs used by the index method when the operator class is selected for an index column. All the operators and functions used by an operator class must be defined before the operator class is created.
  • If a schema name is given, then the operator class is created in the specified schema. Otherwise, it is created in the current schema. Two operator classes in the same schema can have the same name only if they are for different index methods.
  • The user who defines an operator class becomes the owner. Currently, the creator must be a super user.
  • CREATE OPERATOR CLASS does not check whether the class definition includes all the operators and functions required by the index method, nor whether the operators and functions form a self-contained set.
  • Related operator classes can be grouped into operator families. To add a new operator class to an existing family, specify a FAMILY option in CREATE OPERATOR CLASS. Without this option, the new class is placed into a family with the same name (a family is created if it does not exist).

Syntax

CREATE OPERATOR CLASS
name [ DEFAULT ] FOR TYPE data_type
USING index_method [
FAMILY family_name ] AS
{  OPERATOR strategy_number operator_name [ (
op_type, op_type ) ] [ FOR SEARCH | FOR ORDER BY sort_family_name ]
| FUNCTION
support_number [ ( op_type [ , op_type ] ) ] function_name ( argument_type [,
...] )
| STORAGE storage_type
} [, ... ]

Parameters

  • name

    Specifies the name of the operator class to be created (which can be schema-qualified).

  • default

    Specifies that the operator class will become the default operator class for its data type. At most one operator class can be the default for a specific data type and index method.

  • data_type

    Specifies the column data type processed by the operator class.

  • index_method

    Specifies the name of the index method processed by the operator class.

  • family_name

    Specifies the name of an existing operator family where an operator class is added. If not specified, the class is placed into a family with the same name (a family is created if it does not exist).

  • strategy_number

    Specifies the strategy number of the index method associated with the operator class.

  • operator_name

    Specifies the name (which can be schema-qualified) of the operator associated with the operator class.

  • op_type

    Specifies the data type of the operator's operand in an OPERATOR clause. The value NONE represents a left unary operator or right unary operator. The data type of the operand can be omitted if it is the same as that of the operator class.

    In a FUNCTION clause, if the data type of the function's operand is different from the input data type of the function (such as B-tree comparison functions and hash functions) or the class's data type, the data type of the operand supported by this function must be included in this clause. These default values are correct. Therefore, op_type need not be specified in FUNCTION clauses, except in cases where the B-tree sort support function supports cross-type comparisons.

  • sort_family_name

    Specifies the name of an existing B-tree operator family that describes the sort ordering associated with a sort operator.

    The default value is FOR SEARCH.

  • support_number

    Specifies the number of an index method for a function associated with the operator class.

  • function_name

    Specifies a function name of an index method for an operator class.

  • argument_type

    Specifies a data type of a function parameter.

  • storage_type

    Specifies the data type stored in the index. Normally, this is the same as the column data type, but some index methods allow it to be different. The STORAGE clause must be omitted unless the index method allows a different type to be used.

Examples

-- Define a function.
gaussdb=# CREATE FUNCTION func_add_sql(num1 integer, num2 integer) RETURN integer AS BEGIN
RETURN num1 + num2; 
END;
/
-- Create an operator class and associate it with the preceding function.
gaussdb=# CREATE OPERATOR CLASS oc1 DEFAULT FOR TYPE _int4 USING btree AS FUNCTION 1 func_add_sql (integer, integer);

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback