DROP AGGREGATE
Synopsis
Use the DROP AGGREGATE
statement to remove an aggregate.
Syntax
drop_aggregate ::= DROP AGGREGATE [ IF EXISTS ]
{ aggregate_name ( aggregate_signature ) }
[ , ... ] [ CASCADE | RESTRICT ]
aggregate_signature ::= * | aggregate_arg [ , ... ]
| [ aggregate_arg [ , ... ] ] ORDER BY
aggregate_arg [ , ... ]
drop_aggregate
aggregate_signature
Semantics
See the semantics of each option in the [PostgreSQL docs][postgresql-docs-drop-aggregate].
Examples
Basic example.
yugabyte=# CREATE AGGREGATE newcnt(*) (
sfunc = int8inc,
stype = int8,
initcond = '0',
parallel = safe
);
yugabyte=# DROP AGGREGATE newcnt(*);
IF EXISTS
example.
yugabyte=# DROP AGGREGATE IF EXISTS newcnt(*);
yugabyte=# CREATE AGGREGATE newcnt(*) (
sfunc = int8inc,
stype = int8,
initcond = '0',
parallel = safe
);
yugabyte=# DROP AGGREGATE IF EXISTS newcnt(*);
CASCADE
and RESTRICT
example.
yugabyte=# CREATE AGGREGATE newcnt(*) (
sfunc = int8inc,
stype = int8,
initcond = '0',
parallel = safe
);
yugabyte=# CREATE VIEW cascade_view AS
SELECT newcnt(*) FROM pg_aggregate;
yugabyte=# -- The following should error:
yugabyte=# DROP AGGREGATE newcnt(*) RESTRICT;
yugabyte=# -- The following should error:
yugabyte=# DROP AGGREGATE newcnt(*);
yugabyte=# DROP AGGREGATE newcnt(*) CASCADE;
See also
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .