DROP AGGREGATE
Description
Deletes an aggregate function.
Precautions
DROP AGGREGATE deletes an existing aggregate function. Only the owner of the aggregate function can run this command.
Syntax
DROP AGGREGATE [ IF EXISTS ] name ( argtype [ , ... ] ) [ CASCADE | RESTRICT ];
Parameters
- IF EXISTS
Do not throw an error if the specified aggregation does not exist. A notice is issued in this case.
- name
Existing aggregate function name (optionally schema-qualified).
- argtype
Input data type of the aggregate function. To reference a zero-parameter aggregate function, use * to replace the input data type list.
- CASCADE
Cascade deletes objects that depend on the aggregate function.
- RESTRICT
Refuses to delete the aggregate function if any objects depend on it. This is a default processing.
Examples
-- Create a user-defined function. gaussdb=# CREATE OR REPLACE FUNCTION int_add(int,int) RETURNS int AS $BODY$ declare begin return $1 + $2; end; $BODY$ language plpgsql; -- Create an aggregate function. gaussdb=# CREATE AGGREGATE myavg(int) ( sfunc = int_add, stype = int, initcond = '0' ); -- Delete the aggregate function myavg of the int type. gaussdb=# DROP AGGREGATE myavg(int); -- Delete the user-defined function. gaussdb=# DROP FUNCTION int_add(int,int);
Helpful Links
Compatibility
The SQL standard does not provide the DROP AGGREGATE 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