# man > ALTER_AGGREGATE(7)

---
type: CommandReference
command: ALTER AGGREGATE
mode: man
section: 7
source: man-pages
---

## Quick Reference
- Rename an aggregate: `ALTER AGGREGATE name(argtype(s)) RENAME TO new_name`
- Change owner: `ALTER AGGREGATE name(argtype(s)) OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }`
- Set schema: `ALTER AGGREGATE name(argtype(s)) SET SCHEMA new_schema`

## Name
ALTER AGGREGATE — change the definition of an aggregate function

## Synopsis
sql
ALTER AGGREGATE name ( aggregate_signature ) RENAME TO new_name
ALTER AGGREGATE name ( aggregate_signature ) OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER AGGREGATE name ( aggregate_signature ) SET SCHEMA new_schema

-- aggregate_signature is one of:
* 
[ argmode ] [ argname ] argtype [, ... ]
[ [ argmode ] [ argname ] argtype [, ... ] ] ORDER BY [ argmode ] [ argname ] argtype [, ... ]
## Parameters
- `name` — The name (optionally schema-qualified) of an existing aggregate function.
- `argmode` — Argument mode: `IN` or `VARIADIC`. Default is `IN`.
- `argname` — Argument name (ignored; only data types determine identity).
- `argtype` — Input data type. Use `*` for a zero-argument aggregate. For an ordered-set aggregate, write `ORDER BY` between direct and aggregated argument specifications.
- `new_name` — New name for the aggregate.
- `new_owner` — New owner.
- `new_schema` — New schema.

### Privileges
You must own the aggregate. To change the schema, you need `CREATE` privilege on the new schema. To change the owner, you must be a direct or indirect member of the new owning role, and that role must have `CREATE` privilege on the aggregate's schema. A superuser can alter any aggregate's ownership.

## Notes
When referencing an ordered-set aggregate, the recommended syntax is `ORDER BY` between direct and aggregated argument specifications (`CREATE AGGREGATE` style). Omitting `ORDER BY` and merging the lists also works; if `VARIADIC "any"` was used in both lists, write `VARIADIC "any"` only once.

## Examples
Rename aggregate `myavg(integer)` to `my_average`:
sql
ALTER AGGREGATE myavg(integer) RENAME TO my_average;
Change owner of `myavg(integer)` to `joe`:
sql
ALTER AGGREGATE myavg(integer) OWNER TO joe;
Move ordered-set aggregate `mypercentile(float8 ORDER BY integer)` to schema `myschema`:
sql
ALTER AGGREGATE mypercentile(float8 ORDER BY integer) SET SCHEMA myschema;
The same with abbreviated signature:
sql
ALTER AGGREGATE mypercentile(float8, integer) SET SCHEMA myschema;
## See Also
- [CREATE AGGREGATE](http://localhost/phpMan.php/man/AGGREGATE/7/markdown)
- [DROP AGGREGATE](http://localhost/phpMan.php/man/AGGREGATE/7/markdown)