diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-08-26 21:42:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-26 21:42:44 +0200 |
| commit | 081871bc20cc8b28481109b8dcadc321e177e6be (patch) | |
| tree | 3b4a2cfa033ae6c4f25719af818ef0fa47d08756 /docs/ref | |
| parent | 166a3b32632c141541d1c3f0eff18e1d8b389404 (diff) | |
Refs #30511 -- Updated docs about auto-incrementing primary keys on PostgreSQL.
Follow up to 2eea361eff58dd98c409c5227064b901f41bd0d6.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/gis/tutorial.txt | 2 | ||||
| -rw-r--r-- | docs/ref/databases.txt | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/docs/ref/contrib/gis/tutorial.txt b/docs/ref/contrib/gis/tutorial.txt index 1b8f54495a..2a4e082869 100644 --- a/docs/ref/contrib/gis/tutorial.txt +++ b/docs/ref/contrib/gis/tutorial.txt @@ -258,7 +258,7 @@ This command should produce the following output: -- Create model WorldBorder -- CREATE TABLE "world_worldborder" ( - "id" bigserial NOT NULL PRIMARY KEY, + "id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "name" varchar(50) NOT NULL, "area" integer NOT NULL, "pop2005" integer NOT NULL, diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index 442b1a15a3..4b86e24795 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -291,9 +291,9 @@ live for the duration of the transaction. Manually-specifying values of auto-incrementing primary keys ------------------------------------------------------------ -Django uses PostgreSQL's `SERIAL data type`_ to store auto-incrementing primary -keys. A ``SERIAL`` column is populated with values from a `sequence`_ that -keeps track of the next available value. Manually assigning a value to an +Django uses PostgreSQL's identity columns to store auto-incrementing primary +keys. An identity column is populated with values from a `sequence`_ that keeps +track of the next available value. Manually assigning a value to an auto-incrementing field doesn't update the field's sequence, which might later cause a conflict. For example:: @@ -310,7 +310,11 @@ If you need to specify such values, reset the sequence afterward to avoid reusing a value that's already in the table. The :djadmin:`sqlsequencereset` management command generates the SQL statements to do that. -.. _SERIAL data type: https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL +.. versionchanged:: 4.1 + + In older versions, PostgreSQL’s ``SERIAL`` data type was used instead of + identity columns. + .. _sequence: https://www.postgresql.org/docs/current/sql-createsequence.html Test database templates |
