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

PostgreSQL は、Django がサポートする他のデータベースにはない多くの機能を持っています。このオプショナルモジュールには、PostgreSQL 固有のデータ型のためのモデルフィールドとフォームフィールドが含まれています。

> **Note**
>
> Django は、データベースに依存しないウェブフレームワークであり続けます。Django コミュニティ向けに再利用可能なアプリケーションを書く際には、実用的な範囲でデータベースに依存しないコードを書くことをお勧めします。ただし、Django を使って書かれた実際のプロジェクトがデータベースに依存しない必要はありません。実際、プロジェクトが一定規模に達すると、基盤となるデータストアを変更することはすでに大きな課題であり、データストア間の違いを処理するためにコードベースをいくつか変更する必要がある可能性が高くなります。
>
> Djangoは、いくつかのデータ型をサポートしており、これらはPostgreSQLのみで動作します。たとえば、 `contrib.mysql` モジュールが存在しない理由は、PostgreSQLがサポートされているデータベースの中で最も機能が豊富であるため、そのユーザーが最も利益を得るからであり、それ以外に根本的な理由はありません。

- [PostgreSQL 固有の集計関数](/ja/5.0/ref/contrib/postgres/aggregates/)

  - [汎用的な集計関数](/ja/5.0/ref/contrib/postgres/aggregates/#general-purpose-aggregation-functions)
  - [統計のための集計関数](/ja/5.0/ref/contrib/postgres/aggregates/#aggregate-functions-for-statistics)
  - [使用例](/ja/5.0/ref/contrib/postgres/aggregates/#usage-examples)
- [PostgreSQL 固有のデータベース制約](/ja/5.0/ref/contrib/postgres/constraints/)

  - [`ExclusionConstraint`](/ja/5.0/ref/contrib/postgres/constraints/#exclusionconstraint)
- [PostgreSQL 固有のクエリ式](/ja/5.0/ref/contrib/postgres/expressions/)

  - [`ArraySubquery()` 式](/ja/5.0/ref/contrib/postgres/expressions/#arraysubquery-expressions)
- [PostgreSQL 固有のモデルフィールド](/ja/5.0/ref/contrib/postgres/fields/)

  - [これらのフィールドにインデックスを付ける](/ja/5.0/ref/contrib/postgres/fields/#indexing-these-fields)
  - [`ArrayField`](/ja/5.0/ref/contrib/postgres/fields/#arrayfield)
  - [`CIText` フィールド](/ja/5.0/ref/contrib/postgres/fields/#citext-fields)
  - [`HStoreField`](/ja/5.0/ref/contrib/postgres/fields/#hstorefield)
  - [範囲フィールド](/ja/5.0/ref/contrib/postgres/fields/#range-fields)
- [PostgreSQL 固有のフォームフィールドとウィジェット](/ja/5.0/ref/contrib/postgres/forms/)

  - [フィールド](/ja/5.0/ref/contrib/postgres/forms/#fields)
  - [ウィジェット](/ja/5.0/ref/contrib/postgres/forms/#widgets)
- [PostgreSQL 固有のデータベース関数](/ja/5.0/ref/contrib/postgres/functions/)

  - [`RandomUUID`](/ja/5.0/ref/contrib/postgres/functions/#randomuuid)
  - [`TransactionNow`](/ja/5.0/ref/contrib/postgres/functions/#transactionnow)
- [PostgreSQL 固有のモデルインデックス](/ja/5.0/ref/contrib/postgres/indexes/)

  - [`BloomIndex`](/ja/5.0/ref/contrib/postgres/indexes/#bloomindex)
  - [`BrinIndex`](/ja/5.0/ref/contrib/postgres/indexes/#brinindex)
  - [`BTreeIndex`](/ja/5.0/ref/contrib/postgres/indexes/#btreeindex)
  - [`GinIndex`](/ja/5.0/ref/contrib/postgres/indexes/#ginindex)
  - [`GistIndex`](/ja/5.0/ref/contrib/postgres/indexes/#gistindex)
  - [`HashIndex`](/ja/5.0/ref/contrib/postgres/indexes/#hashindex)
  - [`SpGistIndex`](/ja/5.0/ref/contrib/postgres/indexes/#spgistindex)
  - [`OpClass()` 式](/ja/5.0/ref/contrib/postgres/indexes/#opclass-expressions)
- [PostgreSQL 固有のルックアップ](/ja/5.0/ref/contrib/postgres/lookups/)

  - [trigram（トリグラム）類似度](/ja/5.0/ref/contrib/postgres/lookups/#trigram-similarity)
  - [`Unaccent`](/ja/5.0/ref/contrib/postgres/lookups/#unaccent)
- [データベースのマイグレーション・オペレーション](/ja/5.0/ref/contrib/postgres/operations/)

  - [マイグレーションを使って拡張機能を作成する](/ja/5.0/ref/contrib/postgres/operations/#creating-extension-using-migrations)
  - [`CreateExtension`](/ja/5.0/ref/contrib/postgres/operations/#createextension)
  - [`BloomExtension`](/ja/5.0/ref/contrib/postgres/operations/#bloomextension)
  - [`BtreeGinExtension`](/ja/5.0/ref/contrib/postgres/operations/#btreeginextension)
  - [`BtreeGistExtension`](/ja/5.0/ref/contrib/postgres/operations/#btreegistextension)
  - [`CITextExtension`](/ja/5.0/ref/contrib/postgres/operations/#citextextension)
  - [`CryptoExtension`](/ja/5.0/ref/contrib/postgres/operations/#cryptoextension)
  - [`HStoreExtension`](/ja/5.0/ref/contrib/postgres/operations/#hstoreextension)
  - [`TrigramExtension`](/ja/5.0/ref/contrib/postgres/operations/#trigramextension)
  - [`UnaccentExtension`](/ja/5.0/ref/contrib/postgres/operations/#unaccentextension)
  - [マイグレーションを使って照合順序 (collation) を管理する](/ja/5.0/ref/contrib/postgres/operations/#managing-collations-using-migrations)
  - [インデックスの並列操作](/ja/5.0/ref/contrib/postgres/operations/#concurrent-index-operations)
  - [検証を強制しない制約を追加する](/ja/5.0/ref/contrib/postgres/operations/#adding-constraints-without-enforcing-validation)
- [全文検索](/ja/5.0/ref/contrib/postgres/search/)

  - [`search` ルックアップ](/ja/5.0/ref/contrib/postgres/search/#the-search-lookup)
  - [`SearchVector`](/ja/5.0/ref/contrib/postgres/search/#searchvector)
  - [`SearchQuery`](/ja/5.0/ref/contrib/postgres/search/#searchquery)
  - [`SearchRank`](/ja/5.0/ref/contrib/postgres/search/#searchrank)
  - [`SearchHeadline`](/ja/5.0/ref/contrib/postgres/search/#searchheadline)
  - [検索設定を変更する](/ja/5.0/ref/contrib/postgres/search/#changing-the-search-configuration)
  - [クエリを重み付けする](/ja/5.0/ref/contrib/postgres/search/#weighting-queries)
  - [パフォーマンス](/ja/5.0/ref/contrib/postgres/search/#performance)
  - [trigram（トリグラム）類似度](/ja/5.0/ref/contrib/postgres/search/#trigram-similarity)
- [バリデータ (Validator)](/ja/5.0/ref/contrib/postgres/validators/)

  - [`KeysValidator`](/ja/5.0/ref/contrib/postgres/validators/#keysvalidator)
  - [範囲バリデータ](/ja/5.0/ref/contrib/postgres/validators/#range-validators)
