---
title: "django.contrib.postgres"
version: 6.1
locale: it
source: https://docs.djangoproject.com/it/6.1/ref/contrib/postgres/
canonical: https://djangodocs.dev/it/6.1/ref/contrib/postgres/
---
# `django.contrib.postgres`

PostgreSQL has a number of features which are not shared by the other databases
Django supports. This optional module contains model fields and form fields for
a number of PostgreSQL specific data types.

> **Note**
>
> Django is, and will continue to be, a database-agnostic web framework. We
> would encourage those writing reusable applications for the Django
> community to write database-agnostic code where practical. However, we
> recognize that real world projects written using Django need not be
> database-agnostic. In fact, once a project reaches a given size changing
> the underlying data store is already a significant challenge and is likely
> to require changing the code base in some ways to handle differences
> between the data stores.
>
> Django provides support for a number of data types which will
> only work with PostgreSQL. There is no fundamental reason why (for example)
> a `contrib.mysql` module does not exist, except that PostgreSQL has the
> richest feature set of the supported databases so its users have the most
> to gain.

- [PostgreSQL specific aggregation functions](/it/6.1/ref/contrib/postgres/aggregates/)

  - [General-purpose aggregation functions](/it/6.1/ref/contrib/postgres/aggregates/#general-purpose-aggregation-functions)
  - [Aggregate functions for statistics](/it/6.1/ref/contrib/postgres/aggregates/#aggregate-functions-for-statistics)
  - [Usage examples](/it/6.1/ref/contrib/postgres/aggregates/#usage-examples)
- [PostgreSQL specific database constraints](/it/6.1/ref/contrib/postgres/constraints/)

  - [`ExclusionConstraint`](/it/6.1/ref/contrib/postgres/constraints/#exclusionconstraint)
- [PostgreSQL specific query expressions](/it/6.1/ref/contrib/postgres/expressions/)

  - [`ArraySubquery()` expressions](/it/6.1/ref/contrib/postgres/expressions/#arraysubquery-expressions)
- [PostgreSQL specific model fields](/it/6.1/ref/contrib/postgres/fields/)

  - [Indexing these fields](/it/6.1/ref/contrib/postgres/fields/#indexing-these-fields)
  - [`ArrayField`](/it/6.1/ref/contrib/postgres/fields/#arrayfield)
  - [`HStoreField`](/it/6.1/ref/contrib/postgres/fields/#hstorefield)
  - [Range Fields](/it/6.1/ref/contrib/postgres/fields/#range-fields)
- [PostgreSQL specific form fields and widgets](/it/6.1/ref/contrib/postgres/forms/)

  - [Fields](/it/6.1/ref/contrib/postgres/forms/#fields)
  - [Widgets](/it/6.1/ref/contrib/postgres/forms/#widgets)
- [PostgreSQL specific database functions](/it/6.1/ref/contrib/postgres/functions/)

  - [`RandomUUID`](/it/6.1/ref/contrib/postgres/functions/#randomuuid)
  - [`TransactionNow`](/it/6.1/ref/contrib/postgres/functions/#transactionnow)
- [PostgreSQL specific model indexes](/it/6.1/ref/contrib/postgres/indexes/)

  - [`BloomIndex`](/it/6.1/ref/contrib/postgres/indexes/#bloomindex)
  - [`BrinIndex`](/it/6.1/ref/contrib/postgres/indexes/#brinindex)
  - [`BTreeIndex`](/it/6.1/ref/contrib/postgres/indexes/#btreeindex)
  - [`GinIndex`](/it/6.1/ref/contrib/postgres/indexes/#ginindex)
  - [`GistIndex`](/it/6.1/ref/contrib/postgres/indexes/#gistindex)
  - [`HashIndex`](/it/6.1/ref/contrib/postgres/indexes/#hashindex)
  - [`SpGistIndex`](/it/6.1/ref/contrib/postgres/indexes/#spgistindex)
  - [`OpClass()` expressions](/it/6.1/ref/contrib/postgres/indexes/#opclass-expressions)
- [PostgreSQL specific lookups](/it/6.1/ref/contrib/postgres/lookups/)

  - [Trigram similarity](/it/6.1/ref/contrib/postgres/lookups/#trigram-similarity)
  - [`Unaccent`](/it/6.1/ref/contrib/postgres/lookups/#unaccent)
- [Database migration operations](/it/6.1/ref/contrib/postgres/operations/)

  - [Creating extension using migrations](/it/6.1/ref/contrib/postgres/operations/#creating-extension-using-migrations)
  - [`CreateExtension`](/it/6.1/ref/contrib/postgres/operations/#createextension)
  - [`BloomExtension`](/it/6.1/ref/contrib/postgres/operations/#bloomextension)
  - [`BtreeGinExtension`](/it/6.1/ref/contrib/postgres/operations/#btreeginextension)
  - [`BtreeGistExtension`](/it/6.1/ref/contrib/postgres/operations/#btreegistextension)
  - [`CITextExtension`](/it/6.1/ref/contrib/postgres/operations/#citextextension)
  - [`CryptoExtension`](/it/6.1/ref/contrib/postgres/operations/#cryptoextension)
  - [`HStoreExtension`](/it/6.1/ref/contrib/postgres/operations/#hstoreextension)
  - [`TrigramExtension`](/it/6.1/ref/contrib/postgres/operations/#trigramextension)
  - [`UnaccentExtension`](/it/6.1/ref/contrib/postgres/operations/#unaccentextension)
  - [Managing collations using migrations](/it/6.1/ref/contrib/postgres/operations/#managing-collations-using-migrations)
  - [Concurrent index operations](/it/6.1/ref/contrib/postgres/operations/#concurrent-index-operations)
  - [Adding constraints without enforcing validation](/it/6.1/ref/contrib/postgres/operations/#adding-constraints-without-enforcing-validation)
- [Full text search](/it/6.1/ref/contrib/postgres/search/)

  - [The `search` lookup](/it/6.1/ref/contrib/postgres/search/#the-search-lookup)
  - [`SearchVector`](/it/6.1/ref/contrib/postgres/search/#searchvector)
  - [`SearchQuery`](/it/6.1/ref/contrib/postgres/search/#searchquery)
  - [`SearchRank`](/it/6.1/ref/contrib/postgres/search/#searchrank)
  - [`SearchHeadline`](/it/6.1/ref/contrib/postgres/search/#searchheadline)
  - [Changing the search configuration](/it/6.1/ref/contrib/postgres/search/#changing-the-search-configuration)
  - [Weighting queries](/it/6.1/ref/contrib/postgres/search/#weighting-queries)
  - [`Lexeme`](/it/6.1/ref/contrib/postgres/search/#lexeme)
  - [Performance](/it/6.1/ref/contrib/postgres/search/#performance)
  - [Trigram similarity](/it/6.1/ref/contrib/postgres/search/#trigram-similarity)
- [Validators](/it/6.1/ref/contrib/postgres/validators/)

  - [`KeysValidator`](/it/6.1/ref/contrib/postgres/validators/#keysvalidator)
  - [Range validators](/it/6.1/ref/contrib/postgres/validators/#range-validators)
