Bug 117294

Summary: forms_widget_label : wrong setting in sql upgrade script (from 5.2 to 6)
Product: [Retired] Red Hat Web Application Framework Reporter: durnez <vdurnez>
Component: persistenceAssignee: ccm-bugs-list
Status: CLOSED EOL QA Contact: Jon Orris <jorris>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 16:48:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 108447    

Description durnez 2004-03-02 17:13:32 UTC
Description of problem:
Whenever, in simpleSurvey admin ui, i want to edit a new control
("Edit controls" link), i encounter the following exception :

com.arsdigita.persistence.PersistenceException:  (root cause:
com.redhat.persistence.engine.rdbms.RDBMSEngine$2: ORA-02291:
integrity constraint (C4FR_TEST2.FORMS_WGT_LABEL_LABEL_ID_FK) violated
- parent key not found)        at
com.arsdigita.persistence.PersistenceException.newInstance(PersistenceException.java:137)
       at
com.arsdigita.persistence.PersistenceException.newInstance(PersistenceException.java:109)
       at
com.arsdigita.persistence.DataObjectImpl.save(DataObjectImpl.java:413)
[...]

According to file
sql/core/default/formbuilder/table-forms_widget_label.sql (see content
below) :
create table forms_widget_label (    
     label_id integer        constraint forms_wgt_label_label_id_fk  
      
        references bebop_components (component_id)        
        constraint forms_wgt_label_label_id_pk primary key,    
     widget_id integer
        constraint         forms_wgt_label_widget_id_fk
        references bebop_widgets (widget_id) on delete cascade
);

label_id must point to an existing bebop_components item.


but the upgrade script
sql/core/oracle-se/upgrade/5.2.1-6.0.0/auto-upgrade.sql is wrong at
lines 235-237 :
alter table FORMS_WIDGET_LABEL drop constraint
FORMS_WGT_LABEL_LABEL_ID_FK;
alter table FORMS_WIDGET_LABEL add constraint
FORMS_WGT_LABEL_LABEL_ID_FK    foreign key(LABEL_ID) references
BEBOP_WIDGETS(WIDGET_ID);

those lines must be replaced by :

alter table FORMS_WIDGET_LABEL drop constraint
FORMS_WGT_LABEL_LABEL_ID_FK;
alter table FORMS_WIDGET_LABEL add constraint
FORMS_WGT_LABEL_LABEL_ID_FKforeign key(LABEL_ID) references
BEBOP_COMPONENTS(COMPONENT_ID);

That way, new controls can be edited in simple survey admin ui.



How reproducible:
always