Warning

In order for any of the features described below to work, you must use the `PostgresManager` or inherit your models from `PostgresModel`. Read more about this in Managers & Models.

# Annotations

## Renaming annotations

Django does allow you to create an annotation that conflicts with a field on the model. `psqlextra.query.QuerySet.rename_annotation()` makes it possible to do just that.

    from psqlextra.models import PostgresModel
    from django.db.models import Upper

    class MyModel(PostgresModel):
         name = models.TextField()

    MyModel.objects.annotate(name=Upper('name'))

    # OR

    MyModel.objects.annotate(name_upper=Upper('name')).rename_annotations(name='name_upper')