Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0004462Openbravo ERPZ. Otherspublic2008-07-21 10:472008-11-21 13:06
plujan 
alostale 
urgentmajoralways
closedno change required 
10XPsp2
pi 
2.50 
Core
No
0004462: QA-UUID: Generated numbers are not unique on Windows/PostgreSQL
As reported here:
http://archives.postgresql.org/pgsql-bugs/2008-05/msg00059.php [^]

there is an issue for PostgreSQL on Windows so UUIDs are not unique if generator function is called on a 15ms interval.
on PGAdmin run next query:
select get_uuid()
union
select get_uuid();

on a Windows computer and on a Linux computer. On Linux, you will see two records (that means you got two different IDs) but on Windows you will see just one.
No tags attached.
related to defect 00050062.50 closed gmauleon Error: duplicate key value violates unique constraint "ad_field_trl_key" 
has duplicate defect 00053192.50 closed cromero Initial client setup process fails due duplicate key value ad_sequence_key 
Issue History
2008-07-21 10:47plujanNew Issue
2008-07-21 10:47plujanAssigned To => cromero
2008-07-21 10:47plujansf_bug_id0 => 2023360
2008-07-21 10:48plujanAssigned Tocromero => alostale
2008-07-21 10:48plujanSummaryQA-UUID: Generated numbers are not unique => QA-UUID: Generated numbers are not unique on Windows/PostgreSQL
2008-07-21 16:11cromeroStatusnew => scheduled
2008-07-21 16:11cromeroTarget Version => 2.50
2008-10-10 11:31cromeroRelationship addedhas duplicate 0005006
2008-10-10 11:31cromeroRelationship deletedhas duplicate 0005006
2008-10-10 11:32cromeroRelationship addedhas duplicate 0005319
2008-10-22 09:54pjuvaraPrioritynormal => immediate
2008-11-05 10:04alostaleRelationship addedrelated to 0005006
2008-11-05 10:07alostaleNote Added: 0009988
2008-11-05 10:08alostalePriorityimmediate => high
2008-11-12 07:15pjuvaraNote Added: 0010186
2008-11-12 07:15pjuvaraPriorityhigh => urgent
2008-11-12 07:15pjuvaraSeveritycritical => major
2008-11-13 17:14plujanRegression testing => No
2008-11-13 17:14plujanStatusscheduled => closed
2008-11-13 17:14plujanNote Added: 0010253
2008-11-13 17:14plujanResolutionopen => no change required
2008-11-21 13:04rafarodaNote Added: 0010502
2008-11-21 13:06rafarodaNote Added: 0010503

Notes
(0009988)
alostale   
2008-11-05 10:07   
This problem is caused by the postgreSQL contrib library for windows that generates duplicated UUIDs when it is called twice in short periods of time. The issue 0005006 is a workarround for this problem, but could cause a performance decrement for process doing big amounts of insertions in database.
(0010186)
pjuvara   
2008-11-12 07:15   
Downgrading severity since we have a workaround in place which enables basic functionality of the product and the alpha release of the product.
(0010253)
plujan   
2008-11-13 17:14   
This is not an actual Openbravo ERP issue but a PostgreSQL bug. It was solved since 8.3.5.
(0010502)
rafaroda   
2008-11-21 13:04   
Testing function:

CREATE OR REPLACE FUNCTION test_uuidgen(countmax INTEGER) RETURNS character varying AS
$BODY$
DECLARE
  countmin INTEGER := 1;
  distinctuuid bigint;
  v_message VARCHAR(2000) := '';
 
BEGIN
    drop table if exists uuid_gen;
    CREATE TABLE uuid_gen
    (
      uuid_gen_col uuid NOT NULL
     
    );
    LOOP
        INSERT INTO uuid_gen (uuid_gen_col) VALUES (uuid_generate_v1());
        countmin := countmin + 1;
        EXIT WHEN countmin > countmax;
    END LOOP;
    SELECT COUNT(DISTINCT uuid_gen_col) INTO distinctuuid FROM uuid_gen;
    IF distinctuuid <> countmax THEN
        v_message := 'Repeated UUID: FAILS';
    ELSE
        v_message := 'NO repeated UUID: OK';
    END IF;
    RETURN v_message;
END;
$BODY$ LANGUAGE 'plpgsql';
(0010503)
rafaroda   
2008-11-21 13:06   
Add the previous function to your PostgreSQL database and execute:

select test_uuidgen(100000);

If no UUID are repeated you get as result 'NO repeated UUID: OK'