summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/schema.py
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #34553 -- Fixed improper % escaping of literal in constraints.Simon Charette2023-05-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fixed #34505 -- Skipped varchar_pattern_ops/text_pattern_ops index creation ↵Petter Friberg2023-04-211-1/+3
| | | | when db_collation is set in related field.
* Made PostgreSQL's SchemaEditor._create_index_sql() respect the "sql" argument.Dan Glass2023-02-061-1/+1
|
* Refs #33476 -- Applied Black's 2023 stable style.David Smith2023-02-011-1/+0
| | | | | | | | 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
* Fixed #34219 -- Preserved Char/TextField.db_collation when altering column type.Mariusz Felisiak2022-12-221-5/+12
| | | | | | | 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).
* Fixed #33308 -- Added support for psycopg version 3.Daniele Varrazzo2022-12-151-0/+8
| | | | | | | 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>
* Refs #33308 -- Added psycopg_any.sql.quote() hook.Florian Apolloner2022-12-121-6/+2
|
* Refs #33308 -- Moved psycopg2 imports to the psycopg_any module.Florian Apolloner2022-12-121-3/+2
|
* Refs #34058 -- Fixed changing/deleting sequences when altering pre-Django ↵Mariusz Felisiak2022-10-011-25/+36
| | | | | | | | 4.1 auto fields on PostgreSQL. Thanks Anders Kaseorg for the report. Follow up to 19e6efa50b603af325e7f62058364f278596758f. Regression in 2eea361eff58dd98c409c5227064b901f41bd0d6.
* Fixed #34058 -- Changed sequence types when altering pre-Django 4.1 auto ↵Mariusz Felisiak2022-09-291-1/+24
| | | | | | | | | fields on PostgreSQL. Thanks Anders Kaseorg for the report. Thanks Florian Apolloner for pair programming. Regression in 2eea361eff58dd98c409c5227064b901f41bd0d6.
* Fixed #34027 -- Fixed migrations crash when altering type of char/text ↵David Sanders2022-09-251-12/+14
| | | | fields referenced by foreign key on PostgreSQL.
* Fixed #33932 -- Fixed altering AutoFields to OneToOneField on PostgreSQL.Benoît Vinot2022-08-171-1/+1
| | | | Regression in 2eea361eff58dd98c409c5227064b901f41bd0d6.
* Fixed #33901 -- Skipped varchar_pattern_ops/text_pattern_ops index creation ↵Haolun Chai2022-08-151-0/+4
| | | | when db_collation is set.
* Fixed #33881 -- Added support for database collations to ↵Mariusz Felisiak2022-08-021-4/+30
| | | | ArrayField(Char/TextFields).
* Fixed #25105 -- Checked deferred constraints before updating rows on PostgreSQL.David Wobrock2022-05-041-0/+7
|
* Fixed #30511 -- Used identity columns instead of serials on PostgreSQL.Florian Apolloner2022-04-131-56/+30
|
* Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak2022-02-071-2/+4
|
* Refs #33476 -- Reformatted code with Black.django-bot2022-02-071-63/+141
|
* Fixed #26167 -- Added support for functional indexes.Hannes Ljungberg2021-01-131-1/+2
| | | | | | Thanks Simon Charette, Mads Jensen, and Mariusz Felisiak for reviews. Co-authored-by: Markus Holtermann <info@markusholtermann.eu>
* Refs #26167 -- Made DatabaseSchemaEditor._create_index_sql()'s fields ↵Hannes Ljungberg2020-12-231-6/+16
| | | | argument optional and kwarg-only.
* Fixed #24533 -- Dropped PostgreSQL sequence and Oracle identity when ↵Tim Graham2020-08-241-0/+13
| | | | migrating away from AutoField.
* Fixed #31815 -- Fixed schema value encoding on PostgreSQL.Mariusz Felisiak2020-07-271-1/+4
|
* Fixed #31735 -- Fixed migrations crash on namespaced inline FK addition on ↵Simon Charette2020-06-241-1/+1
| | | | | | | | | | | PostgreSQL. The namespace of the constraint must be included when making the constraint immediate. Regression in 22ce5d0031bd795ade081394043833e82046016c. Thanks Rodrigo Estevao for the report.
* Fixed #30913 -- Added support for covering indexes on PostgreSQL 11+.Hannes Ljungberg2020-06-041-3/+8
|
* Fixed #31106 -- Fixed migrations crash on PostgreSQL 10+ when adding FK ↵Mariusz Felisiak2019-12-231-1/+6
| | | | | | | | | | | 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.
* Refs #28816 -- Prevented silencing data loss when decreasing ↵Hasan Ramezani2019-10-171-2/+16
| | | | CharField.max_length for ArrayField.base_field on PostgreSQL.
* Fixed #30800 -- Fixed migrations crash when altering a field with custom ↵Mariusz Felisiak2019-09-251-1/+4
| | | | | db_type(). Regression in 1378d665a1c85897d951f2ca9618b848fdbba2e7.
* Fixed #21039 -- Added AddIndexConcurrently/RemoveIndexConcurrently ↵Mads Jensen2019-08-211-0/+25
| | | | | | | | operations for PostgreSQL. Thanks to Simon Charettes for review. Co-Authored-By: Daniel Tao <daniel.tao@gmail.com>
* Fixed #30661 -- Added models.SmallAutoField.Nick Pope2019-08-021-3/+3
|
* Refs #30664 -- Fixed migrations crash when altering AutoField/BigAutoField ↵Mariusz Felisiak2019-08-011-1/+1
| | | | with quoted db_column on PostgreSQL.
* Fixed #30664 -- Fixed migrations crash when altering table on SQLite or ↵Ngalim Siregar2019-08-011-1/+2
| | | | altering AutoField/BigAutoField on PostgreSQL for models with quoted db_table.
* Fixed #28816 -- Prevented silencing data loss when decreasing ↵Hasan Ramezani2019-05-211-3/+10
| | | | CharField.max_length on PostgreSQL.
* Fixed #30408 -- Fixed crash when adding check constraints with LIKE operator ↵Simon Charette2019-04-301-0/+2
| | | | | | | | | | | | | | 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.
* Fixed #30266 -- Kept a sequence owner when altering an ↵Dolan Antenucci2019-04-081-0/+9
| | | | AutoField/BigAutoField on PostgreSQL.
* Fixed "byte string" typo in various docs and comments.Mariusz Felisiak2019-03-281-1/+1
|
* Fixed #30258 -- Adjusted postgres schema value quoting of ranges.Simon Charette2019-03-181-1/+2
| | | | Thanks Tilman Koschnick for the report and patch.
* Fixed #30108 -- Allowed adding foreign key constraints in the same statement ↵Dan Tao2019-01-291-0/+1
| | | | that adds a field.
* Fixed #30060 -- Moved SQL generation for indexes and constraints to ↵Paveł Tyślacki2019-01-011-2/+2
| | | | SchemaEditor.
* Fixed #29547 -- Added support for partial indexes.Mads Jensen2018-10-291-1/+1
| | | | | Thanks to Ian Foote, Mariusz Felisiak, Simon Charettes, and Markus Holtermann for comments and feedback.
* Fixed #28077 -- Added support for PostgreSQL opclasses in Index.Ian Foote2018-06-291-4/+8
| | | | Thanks Vinay Karanam for the initial patch.
* Fixed #28702 -- Made query lookups for CIText fields use citext.Mads Jensen2017-11-291-3/+4
|
* Refs #23766 -- Added tests for CursorWrapper.callproc().Mariusz Felisiak2017-08-081-0/+2
| | | Thanks Tim Graham for the review.
* Refs #25530 -- Changed _create_index_name to take a table as first parameter.Simon Charette2017-06-201-2/+2
|
* Fixed #28275 -- Added more hooks to SchemaEditor._alter_field().Florian Apolloner2017-06-061-2/+3
|
* Fixed #27860 -- Dropped varchar_pattern_ops/text_pattern_ops index before ↵Mariusz Felisiak2017-05-241-0/+9
| | | | | altering char/text field in PostgreSQL. Thanks Tim Graham for the review.
* Refs #27860 -- Simplified deleting indexes on PostgreSQL using "IF EXISTS".Mariusz Felisiak2017-03-031-4/+2
|
* Refs #27656 -- Updated django.db docstring verbs according to PEP 257.Anton Samarchyan2017-02-281-3/+1
|
* Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand2017-01-251-5/+3
|
* Fixed #25492 -- Checked deferred foreign key constraints before dropping them.Simon Charette2016-12-241-0/+4
| | | | | | | This allows running foreign key data and schema altering operations in the same migration on PostgreSQL. Thanks Tim for review.
* Fixed #27030 -- Added contrib.postgres.indexes.GinIndex.Akshesh2016-08-121-0/+1
|