Modify

Ticket #412 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

Oracle backend generates wrong sql for some fields

Reported by: Siddharta <siddharta@…> Owned by: andrew
Priority: major Milestone: 1.0
Component: migrations Version: 0.7
Keywords: oracle Cc:

Description

The Oracle backend correctly generates sql for null columns with a default value by swapping the order.

NULL DEFAULT ' ' => DEFAULT ' ' NULL

In the above case the left is the default column SQL and the right is the correct SQL to run on Oracle. The backend deals with the above case, but leaves out the following cases

NULL PRIMARY KEY DEFAULT ' ' => DEFAULT ' ' PRIMARY KEY NULL
NOT NULL DEFAULT ' ' => DEFAULT ' ' NOT NULL
NOT NULL PRIMARY KEY DEFAULT ' ' => DEFAULT ' ' PRIMARY KEY NOT NULL

So if you have a field that is NOT NULL and PRIMARY KEY and has a default (or any one of those 3 cases), then the sql generated will cause this error:

ORA-00907: missing right parenthesis

Attachments

south.diff (961 bytes) - added by andrew 3 years ago.

Change History

comment:1 Changed 4 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 0.7.1

comment:2 Changed 4 years ago by andrew

  • Milestone changed from 0.7.1 to 0.7.2

comment:3 Changed 4 years ago by andrew

  • Milestone changed from 0.7.2 to 1.0

comment:4 Changed 4 years ago by anonymous

any work around for this as of now ?

comment:5 Changed 4 years ago by andrew

Not really; I'm not able to maintain the Oracle code, so I can't really fix and test this, and there's no workaround, since the generated SQL is wrong. I recommend you either use db.execute to send the SQL manually, or don't use South with Oracle for now...

Changed 3 years ago by andrew

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.