Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0020505Openbravo ERPA. Platformpublic2012-05-15 13:492022-02-01 08:08
mirurita 
Triage Platform Base 
normalmajoralways
newopen 
5
 
 
Core
No
0020505: Validate during export.database any unique constraint containing nullable columns
unique constraints containing nullable columns are not working as expected in PostgreSQL.

we should add a validation (clear warning message) during export.database ant target for checking any unique constraint defined with nullable columns.

http://www.postgresql.org/docs/8.1/static/ddl-constraints.html [^] [^]

"In general, a unique constraint is violated when there are two or more rows in the table where the values of all of the columns included in the constraint are equal. However, null values are not considered equal in this comparison. That means even in the presence of a unique constraint it is possible to store duplicate rows that contain a null value in at least one of the constrained columns. This behavior conforms to the SQL standard, but we have heard that other SQL databases may not follow this rule. So be careful when developing applications that are intended to be portable."
[PostgreSQL]

c_conversion_rate_document table has the following unique constraint:
constraint c_conversionratedoc_once UNIQUE (c_currency_id, c_currency_id_to, c_invoice_id, fin_payment_id, aprm_finacc_transaction_v_id)

1) Disable the trigger for c_conversion_rate_document
2) Create a new Sales Invoice
3) Go to Exchange Rates tab
4) Create new Exchange Rate (EUR --> EUR)
    - Currency: EUR
    - To Currency: EUR
5) Create again the same exchange rate for EUR --> EUR
    - Currency: EUR
    - To Currency: EUR
6) The unique constraint defined should not allow to create the record in step 4
7) The system allows to create a duplicate exchange rate.
No tags attached.
related to defect 0020142 closed mirurita In Exchange Rate tab, in Sales Invoice Window, it allows to enter more than one exchange rate for the same pair of currencies. 
Issue History
2012-05-15 13:49miruritaNew Issue
2012-05-15 13:49miruritaAssigned To => alostale
2012-05-15 13:49miruritaModules => Core
2012-05-15 13:57shuehnerIssue Monitored: shuehner
2012-05-15 13:58shuehnerNote Added: 0048648
2012-05-15 16:23miruritaRelationship addedrelated to 0020142
2017-04-10 14:37alostaleAssigned Toalostale => platform
2022-02-01 08:08alostaleAssigned Toplatform => Triage Platform Base

Notes
(0048648)
shuehner   
2012-05-15 13:58   
Note: New validation should appear somewhere to developer:
- might be wad-validation
- or export.database