Modify

Ticket #252 (closed defect: fixed)

Opened 2 years ago

Last modified 8 months ago

Removing check constraint fails with uppercase constraint name in Postgres

Reported by: ubercore Owned by: andrew
Priority: major Milestone: 0.6.2
Component: databaseapi Version: 0.6.1
Keywords: Cc:

Description

I have a PositiveIntegerField? called ADA. The check constraint generated is called appname_model_ADA_check. When changing the column to nullable, South generates the following sql to drop the constraint:

ALTER TABLE appname_model DROP CONSTRAINT appname_model_ADA_check

This statement fails:

psycopg2.ProgrammingError: constraint "appname_model_ada_check" does not exist

This is because postgresql drops all unquoted identifiers to lowercase ( http://www.postgresql.org/docs/8.0/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS). The following sql, with a quoted identifier, works properly:

ALTER TABLE appname_model DROP CONSTRAINT "appname_model_ADA_check"

Attachments

Change History

comment:1 Changed 2 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.6.2

Fixed in [4c06786f7b78].

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.