ALTER OPERATOR
Description
Modifies the definition of an operator.
Precautions
To use ALTER OPERATOR, you must be the owner of the operator. To modify the owner, you must also be a direct or indirect member of the new owning role, and that member must have CREATE permission on the operator's schema. (These restrict that the owner cannot be changed by doing anything other than deleting or rebuilding the operator. However, a user with the SYSADMIN permission can modify the ownership of any operator in any way.)
Syntax
- Change the owner of the operator.
ALTER OPERATOR name ( { left_type | NONE } , { right_type | NONE } ) OWNER TO new_owner;
- Change the schema of the operator.
ALTER OPERATOR name ( { left_type | NONE } , { right_type | NONE } ) SET SCHEMA new_schema;
Parameters
- name
Name of an existing operator.
- left_type
Data type of the left operand for the operator; if there is no left operand, write NONE.
- right_type
Data type of the right operand for the operator; if there is no right operand, write NONE.
- new_owner
New owner of the operator.
- new_schema
New schema name of the operator.
Example
-- Create a function. gaussdb=# CREATE FUNCTION func_add(num1 integer, num2 integer) RETURN INTEGER AS BEGIN RETURN num1+num2; END; / -- Create an operator. gaussdb=# CREATE OPERATOR @@@ (PROCEDURE = func_add,LEFTARG = int,RIGHTARG = int); -- Create a user. gaussdb=# CREATE USER user1 PASSWORD '********'; -- Modify the operator. gaussdb=# ALTER OPERATOR @@@ (int,int) OWNER to user1; -- Create a schema. gaussdb=# CREATE SCHEMA oper_sch; -- Modify the operator. gaussdb=# ALTER OPERATOR @@@ (int,int) SET SCHEMA oper_sch; -- Delete. gaussdb=# DROP OPERATOR oper_sch.@@@(int,int); gaussdb=# DROP SCHEMA oper_sch; gaussdb=# DROP USER user1;
Helpful Links
Compatibility
The SQL standard does not contain the ALTER OPERATOR statement.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot