Opened 10 years ago

Closed 10 years ago

#24051 closed Bug (fixed)

Tables are not created in specified tablespace when DEFAULT_TABLESPACE is specified

Reported by: douglasjreynolds Owned by: nobody
Component: Database layer (models, ORM) Version: 1.7
Severity: Release blocker Keywords: Tablespace model
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When DEFAULT_TABLESPACE is specified in the project settings.py using database backend, django.db.backends.postgresql_psycopg2, the DDL does not include the 'TABLESPACE' keyword, and the table is created in the default PostgreSQL tablespace.

This does not affect the INDEX tablespace. The INDEXes are always created in the correct tablespace (both with just DEFAULT_TABLESPACE and/or DEFAULT_INDEX_TABLESPACE).

The patch is based off of Django 1.7.1.
I have attached a patch to correct this issue. It fixed the issue for me.

Attachments (1)

django_tablespace_patch.diff (692 bytes ) - added by douglasjreynolds 10 years ago.
Tablespace patch of django.db.backends.schema

Download all attachments as: .zip

Change History (7)

by douglasjreynolds, 10 years ago

Tablespace patch of django.db.backends.schema

comment:1 by Tim Graham, 10 years ago

Needs tests: set
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Could you add a test and release notes for 1.7.2? If you are able to send a pull request on GitHub, that will ease testing and review, thanks.

in reply to:  1 ; comment:2 by douglasjreynolds, 10 years ago

Replying to timgraham:

Could you add a test and release notes for 1.7.2? If you are able to send a pull request on GitHub, that will ease testing and review, thanks.

I am attempting to get a pull request ready for you on GitHub. I am not real familiar with GitHub, so bear with me.

in reply to:  2 comment:3 by douglasjreynolds, 10 years ago

Replying to douglasjreynolds:

Replying to timgraham:

Could you add a test and release notes for 1.7.2? If you are able to send a pull request on GitHub, that will ease testing and review, thanks.

I am attempting to get a pull request ready for you on GitHub. I am not real familiar with GitHub, so bear with me.

I have put the code, tests, and documentation in pull request https://github.com/django/django/pull/3796

After looking at the master branch, I saw that code had been included to correct this issue. It looks like this was caused by the new makemigration code in 1.7.

Let me know if you need anything else!

comment:4 by Claude Paroz, 10 years ago

Needs tests: unset

Alternate patch without creating new tests: https://github.com/django/django/pull/3798

comment:5 by Tim Graham, 10 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Claude Paroz <claude@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 322560489b2d2f873c7b8bd7799efd7cf80fb28b:

[1.7.x] Fixed #24051 -- Made schema infrastructure honor tablespaces

Partial backport of 30cbd5d36. Thanks Douglas J. Reynolds for the
report and initial patch.

Note: See TracTickets for help on using tickets.
Back to Top