summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/schema.py
AgeCommit message (Collapse)Author
2025-10-18Fixed #21961 -- Added support for database-level delete options for ForeignKey.Mariusz Felisiak
Thanks Simon Charette for pair programming. Co-authored-by: Nick Stefan <NickStefan12@gmail.com> Co-authored-by: Akash Kumar Sen <71623442+Akash-Kumar-Sen@users.noreply.github.com> Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-02-05Fixed #36165 -- Made PostgreSQL's SchemaEditor._delete_index_sql() respect ↵Natalia
the "sql" argument. This is a follow up of bd366ca2aeffa869b7dbc0b0aa01caea75e6dc31. Thank you Daniel Finch for the report.
2024-12-17Fixed #35969 -- Disallowed specifying a USING clause for altered generated ↵lufafajoshua
field. PostgreSQL versions 16.5 and above no longer permit the use of a USING clause when changing the type of a generated column.
2024-10-31Fixed #35180 -- Recreated PostgreSQL _like indexes when changing between ↵Ben Cail
TextField and CharField field types.
2024-08-01Reverted "Fixed #28646 -- Prevented duplicate index when unique is set to ↵Sarah Boyce
True on PostgreSQL." This reverts commit 9cf9c796be8dd53bc3b11355ff39d65c81d7be6d due to a crash on Oracle as it didn't allow multiple indexes on the same field.
2024-07-30Fixed #28646 -- Prevented duplicate index when unique is set to True on ↵Ben Cail
PostgreSQL.
2024-03-25Removed unused _alter_column_collation_sql() in PostgreSQL DatabaseSchemaEditor.Mariusz Felisiak
Unused since ae0899be0d787fbfc5f5ab2b18c5a8219d822d2b.
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-10-30Fixed #34932 -- Restored varchar_pattern_ops/text_pattern_ops index creation ↵Tom Carrick
when deterministic collaction is set. Regression in f3f9d03edf17ccfa17263c7efa0b1350d1ac9278 (4.2) and 8ed25d65ea7546fafd808086fa07e7e5bb5428fc (5.0).
2023-05-10Fixed #34553 -- Fixed improper % escaping of literal in constraints.Simon Charette
Proper escaping of % in string literals used when defining constaints was attempted (a8b3f96f6) by overriding quote_value of Postgres and Oracle schema editor. The same approach was used when adding support for constraints to the MySQL/MariaDB backend (1fc2c70). Later on it was discovered that this approach was not appropriate and that a preferable one was to pass params=None when executing the constraint creation DDL to avoid any form of interpolation in the first place (42e8cf47). When the second patch was applied the corrective of the first were not removed which caused % literals to be unnecessary doubled. This flew under the radar because the existings test were crafted in a way that consecutive %% didn't catch regressions. This commit introduces an extra test for __exact lookups which highlights more adequately % doubling problems but also adjust a previous __endswith test to cover % doubling problems (%\% -> %%\%%). Thanks Thomas Kolar for the report. Refs #32369, #30408, #30593.
2023-04-21Fixed #34505 -- Skipped varchar_pattern_ops/text_pattern_ops index creation ↵Petter Friberg
when db_collation is set in related field.
2023-02-06Made PostgreSQL's SchemaEditor._create_index_sql() respect the "sql" argument.Dan Glass
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
2022-12-22Fixed #34219 -- Preserved Char/TextField.db_collation when altering column type.Mariusz Felisiak
This moves setting a database collation to the column type alteration as both must be set at the same time. This should also avoid another layer of the column type alteration when adding database comments support (#18468).
2022-12-15Fixed #33308 -- Added support for psycopg version 3.Daniele Varrazzo
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews. Co-authored-by: Florian Apolloner <florian@apolloner.eu> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-12Refs #33308 -- Added psycopg_any.sql.quote() hook.Florian Apolloner
2022-12-12Refs #33308 -- Moved psycopg2 imports to the psycopg_any module.Florian Apolloner
2022-10-01Refs #34058 -- Fixed changing/deleting sequences when altering pre-Django ↵Mariusz Felisiak
4.1 auto fields on PostgreSQL. Thanks Anders Kaseorg for the report. Follow up to 19e6efa50b603af325e7f62058364f278596758f. Regression in 2eea361eff58dd98c409c5227064b901f41bd0d6.
2022-09-29Fixed #34058 -- Changed sequence types when altering pre-Django 4.1 auto ↵Mariusz Felisiak
fields on PostgreSQL. Thanks Anders Kaseorg for the report. Thanks Florian Apolloner for pair programming. Regression in 2eea361eff58dd98c409c5227064b901f41bd0d6.
2022-09-25Fixed #34027 -- Fixed migrations crash when altering type of char/text ↵David Sanders
fields referenced by foreign key on PostgreSQL.
2022-08-17Fixed #33932 -- Fixed altering AutoFields to OneToOneField on PostgreSQL.Benoît Vinot
Regression in 2eea361eff58dd98c409c5227064b901f41bd0d6.
2022-08-15Fixed #33901 -- Skipped varchar_pattern_ops/text_pattern_ops index creation ↵Haolun Chai
when db_collation is set.
2022-08-02Fixed #33881 -- Added support for database collations to ↵Mariusz Felisiak
ArrayField(Char/TextFields).
2022-05-04Fixed #25105 -- Checked deferred constraints before updating rows on PostgreSQL.David Wobrock
2022-04-13Fixed #30511 -- Used identity columns instead of serials on PostgreSQL.Florian Apolloner
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-01-13Fixed #26167 -- Added support for functional indexes.Hannes Ljungberg
Thanks Simon Charette, Mads Jensen, and Mariusz Felisiak for reviews. Co-authored-by: Markus Holtermann <info@markusholtermann.eu>
2020-12-23Refs #26167 -- Made DatabaseSchemaEditor._create_index_sql()'s fields ↵Hannes Ljungberg
argument optional and kwarg-only.
2020-08-24Fixed #24533 -- Dropped PostgreSQL sequence and Oracle identity when ↵Tim Graham
migrating away from AutoField.
2020-07-27Fixed #31815 -- Fixed schema value encoding on PostgreSQL.Mariusz Felisiak
2020-06-24Fixed #31735 -- Fixed migrations crash on namespaced inline FK addition on ↵Simon Charette
PostgreSQL. The namespace of the constraint must be included when making the constraint immediate. Regression in 22ce5d0031bd795ade081394043833e82046016c. Thanks Rodrigo Estevao for the report.
2020-06-04Fixed #30913 -- Added support for covering indexes on PostgreSQL 11+.Hannes Ljungberg
2019-12-23Fixed #31106 -- Fixed migrations crash on PostgreSQL 10+ when adding FK ↵Mariusz Felisiak
constraints inline and changing data. This allows adding foreign key constraints inline and changing data in the same migration on PostgreSQL 10+. Regression in 738faf9da2a5cd03148a36375db80746c99c9623. Thanks Janne Rönkkö for the report and Simon Charette for the implementation idea and review.
2019-10-17Refs #28816 -- Prevented silencing data loss when decreasing ↵Hasan Ramezani
CharField.max_length for ArrayField.base_field on PostgreSQL.
2019-09-25Fixed #30800 -- Fixed migrations crash when altering a field with custom ↵Mariusz Felisiak
db_type(). Regression in 1378d665a1c85897d951f2ca9618b848fdbba2e7.
2019-08-21Fixed #21039 -- Added AddIndexConcurrently/RemoveIndexConcurrently ↵Mads Jensen
operations for PostgreSQL. Thanks to Simon Charettes for review. Co-Authored-By: Daniel Tao <daniel.tao@gmail.com>
2019-08-02Fixed #30661 -- Added models.SmallAutoField.Nick Pope
2019-08-01Refs #30664 -- Fixed migrations crash when altering AutoField/BigAutoField ↵Mariusz Felisiak
with quoted db_column on PostgreSQL.
2019-08-01Fixed #30664 -- Fixed migrations crash when altering table on SQLite or ↵Ngalim Siregar
altering AutoField/BigAutoField on PostgreSQL for models with quoted db_table.
2019-05-21Fixed #28816 -- Prevented silencing data loss when decreasing ↵Hasan Ramezani
CharField.max_length on PostgreSQL.
2019-04-30Fixed #30408 -- Fixed crash when adding check constraints with LIKE operator ↵Simon Charette
on Oracle and PostgreSQL. The LIKE operator wildcard generated for contains, startswith, endswith and their case-insensitive variant lookups was conflicting with parameter interpolation on CREATE constraint statement execution. Ideally we'd delegate parameters interpolation in DDL statements on backends that support it but that would require backward incompatible changes to the Index and Constraint SQL generating methods. Thanks David Sanders for the report.
2019-04-08Fixed #30266 -- Kept a sequence owner when altering an ↵Dolan Antenucci
AutoField/BigAutoField on PostgreSQL.
2019-03-28Fixed "byte string" typo in various docs and comments.Mariusz Felisiak
2019-03-18Fixed #30258 -- Adjusted postgres schema value quoting of ranges.Simon Charette
Thanks Tilman Koschnick for the report and patch.
2019-01-29Fixed #30108 -- Allowed adding foreign key constraints in the same statement ↵Dan Tao
that adds a field.
2019-01-01Fixed #30060 -- Moved SQL generation for indexes and constraints to ↵Paveł Tyślacki
SchemaEditor.
2018-10-29Fixed #29547 -- Added support for partial indexes.Mads Jensen
Thanks to Ian Foote, Mariusz Felisiak, Simon Charettes, and Markus Holtermann for comments and feedback.
2018-06-29Fixed #28077 -- Added support for PostgreSQL opclasses in Index.Ian Foote
Thanks Vinay Karanam for the initial patch.
2017-11-29Fixed #28702 -- Made query lookups for CIText fields use citext.Mads Jensen