Oracle SQL/DAL Bug Issue on Alter Table

10 views
Skip to first unread message

Boris Aramis Aguilar Rodríguez

unread,
Jul 1, 2015, 10:35:53 AM7/1/15
to web...@googlegroups.com

Hi all,

I'm currently working on web2py with an Oracle Database backend (Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production) but I'm having an issue with the generated Oracle command for altering a table.

I had a table definition as follows (in web2py):

db.define_table('device',
                Field('hostname', 'string', requires=IS_NOT_EMPTY(), label=T('Hostname')),
                Field('device_location', 'string', label=T('Location')),
... more stuff)

and updated it
db.define_table('device',
                Field('hostname', 'string', requires=IS_NOT_EMPTY(), label=T('Hostname')),
                Field('device_location', 'string', label=T('Location')),
                Field('dashboard_category', 'reference dashboard_category', label = T('Category')),
... more stuff)

so the DAL generated the following statement for altering the device table:

ALTER TABLE device ADD dashboard_category NUMBER, ADD CONSTRAINT device_dashboa__constraint FOREIGN KEY (dashboard_category) REFERENCES dashboard_category (id) ON DELETE CASCADE;

(whis is wrong!!!)
It had to generate

ALTER TABLE device ADD dashboard_category NUMBER ADD CONSTRAINT device_dashboa__constraint FOREIGN KEY (dashboard_category) REFERENCES dashboard_category (id) ON DELETE CASCADE;

It added an extra comma that makes the command to fail. I now have to manually update the database with a fake_migrate help but i guess this is a bug
Reply all
Reply to author
Forward
0 new messages