---
title: "django.contrib.postgres"
version: 4.2
locale: es
source: https://docs.djangoproject.com/es/4.2/ref/contrib/postgres/
canonical: https://djangodocs.dev/es/4.2/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](/es/4.2/ref/contrib/postgres/aggregates/)

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

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

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

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

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

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

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

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

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

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

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