Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0018726Openbravo ERP00. Application dictionarypublic2011-10-07 11:272022-02-01 08:08
roklenardic 
Triage Platform Base 
normalminoralways
acknowledgedopen 
5
pi 
 
Google Chrome
Core
No
0018726: AD_TAB is missing a unique constraint for SEQNO
When creating tabs inside windows, it is currently possible to create two tabs within the same window with the SAME SEQNO.

It is also possible to export and package the module without any validation error. But on installation of such module, it fails.
1) have a module in Development
2) create a new window
3) create tab 1 (SEQNO=10) and save
4) create tab 2 (SEQNO=10) and save

a unique constraint error should be thrown.
Add a unique constraint: ad_window_id+seqno
No tags attached.
Issue History
2011-10-07 11:27roklenardicNew Issue
2011-10-07 11:27roklenardicAssigned To => alostale
2011-10-07 11:27roklenardicWeb browser => Google Chrome
2011-10-07 11:27roklenardicModules => Core
2011-10-07 11:43shuehnerNote Added: 0041549
2011-10-07 11:52roklenardicNote Added: 0041553
2011-10-07 11:52roklenardicNote Edited: 0041553bug_revision_view_page.php?bugnote_id=0041553#r2788
2012-02-28 16:40alostaleWeb browserGoogle Chrome => Google Chrome
2012-02-28 16:40alostaleNote Added: 0045547
2012-02-28 16:40alostaleTypedefect => design defect
2012-09-24 21:06AugustoMauchWeb browserGoogle Chrome => Google Chrome
2012-09-24 21:06AugustoMauchNote Added: 0052421
2012-09-24 21:06AugustoMauchStatusnew => scheduled
2017-03-31 14:36alostaleStatusscheduled => acknowledged
2017-04-10 14:33alostaleAssigned Toalostale => platform
2022-02-01 08:08alostaleAssigned Toplatform => Triage Platform Base

Notes
(0041549)
shuehner   
2011-10-07 11:43   
Note: probably not possible as can lead to module conflicting which each other when two independent modules add different tabs to the same window.

So other proposal:
1.) add i.e. wad-validation to advise people of the problem
2.) change code using 'order by seqno' to read 'order by seqno,name' or similar to ensure a stable/predictable order is used in case of duplicate seqno-values
3.) add i.e. callout to verify that the duplicate seqno is avoided in the usecase described in the issue (to not have duplicates in the same module), note that smaller part could also be achieved by a unique constraint containing also ad_module_id)
(0041553)
roklenardic   
2011-10-07 11:52   
In that case, the module installation needs to be revised because currently it fails when two tabs have the same SEQNO within the same window.

This is the error:

database.postupdate.POSTGRE:
      [sql] Executing commands
      [sql] Failed to execute: SELECT AD_UPDATE_ACCESS()

BUILD FAILED
/opt/OpenbravoERP/build.xml:362: The following error occurred while executing this line:
/opt/OpenbravoERP/build.xml:396: The following error occurred while executing this line:
/opt/OpenbravoERP/build.xml:713: The following error occurred while executing this line:
/opt/OpenbravoERP/src-db/database/build.xml:103: The following error occurred while executing this line:
/opt/OpenbravoERP/src-db/database/build.xml:178: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "ad_window_access_un_key"
  Where: SQL statement "INSERT INTO aD_Window_Access ( aD_Window_Access_ID, AD_Window_ID, AD_Role_ID, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, IsReadWrite ) SELECT DISTINCT get_uuid(), AD_WINDOW.AD_WINDOW_ID, AD_ROLE.AD_ROLE_ID, AD_ROLE.AD_CLIENT_ID, AD_ROLE.AD_ORG_ID, 'Y', TO_DATE(NOW()), '0', TO_DATE(NOW()), '0', 'Y' FROM AD_WINDOW, AD_ROLE, AD_TAB, AD_TABLE WHERE AD_ROLE.ISMANUAL = 'N' AND AD_WINDOW.IsActive='Y' AND AD_WINDOW.AD_WINDOW_ID = AD_TAB.AD_WINDOW_ID AND AD_TAB.AD_TABLE_ID = AD_TABLE.AD_TABLE_ID AND ( (AD_ROLE.USERLEVEL = 'S' AND AD_TABLE.ACCESSLEVEL IN ('4','7','6')) OR (AD_ROLE.USERLEVEL IN (' CO', ' C') AND AD_TABLE.ACCESSLEVEL IN ('7','6','3','1')) OR (AD_ROLE.USERLEVEL = ' O' AND AD_TABLE.ACCESSLEVEL IN ('3','1','7')) ) AND AD_TAB.SEQNO = (SELECT MIN(SEQNO) FROM AD_TAB t WHERE t.AD_WINDOW_ID = AD_WINDOW.AD_WINDOW_ID) AND NOT EXISTS (SELECT 1 FROM AD_WINDOW_ACCESS WHERE AD_WINDOW_ID = AD_WINDOW.AD_WINDOW_ID AND AD_ROLE_ID = AD_ROLE.AD_ROLE_ID)"
PL/pgSQL function "ad_update_access" line 90 at SQL statement

(0045547)
alostale   
2012-02-28 16:40   
Changing to design defect, as current design is not taking into account this case.
(0052421)
AugustoMauch   
2012-09-24 21:06   
Impact: low
Plan: mid