Skip site navigation (1) Skip section navigation (2)

Re: BUG #4274: uuid returns duplicate values

From: "Eric P(dot) Melbardis" <eric(dot)melbardis(at)netkitsolutions(dot)com>
To: "Hiroshi Saito" <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #4274: uuid returns duplicate values
Date: 2008-07-02 00:24:32
Message-ID: EF3FC357692A7A418A0D4CA7ACE7F4F20296BA38@mail.netkitsolutions.com (view raw or flat)
Thread:
Lists: pgsql-bugs
Hi


I would suspect that the clock used may not be precise enough

Not with standing, why not use the windows CreateUUID??

Slower system seems to fare better... (please see results below)

Regards

Eric


-------------------
My office system is xeon (duo core 5160) 3.00 ghz, 2 gig-ram

psql:q.sql:168: INFO:  uuid = b2631eb7-26ad-4b40-9276-ed1fc43f0944
psql:q.sql:168: INFO:  uuid = 45472e3e-a88e-46ff-b2b1-cfa229b8c568
psql:q.sql:168: INFO:  uuid = 45472e3e-a88e-46ff-b2b1-cfa229b8c568
psql:q.sql:168: INFO:  uuid = 45472e3e-a88e-46ff-b2b1-cfa229b8c568
psql:q.sql:168: INFO:  uuid = 45472e3e-a88e-46ff-b2b1-cfa229b8c568
psql:q.sql:168: INFO:  uuid = 45472e3e-a88e-46ff-b2b1-cfa229b8c568
psql:q.sql:168: INFO:  uuid = 45472e3e-a88e-46ff-b2b1-cfa229b8c568
psql:q.sql:168: INFO:  uuid = 45472e3e-a88e-46ff-b2b1-cfa229b8c568
psql:q.sql:168: INFO:  uuid = efd009ab-c38b-4efa-8b0c-4ef0280dc781
psql:q.sql:168: INFO:  uuid = 10c8c7aa-1367-44fa-ac76-a0f9b1ca69b7
psql:q.sql:168: INFO:  uuid = 10c8c7aa-1367-44fa-ac76-a0f9b1ca69b7
psql:q.sql:168: INFO:  uuid = 10c8c7aa-1367-44fa-ac76-a0f9b1ca69b7
psql:q.sql:168: INFO:  uuid = 10c8c7aa-1367-44fa-ac76-a0f9b1ca69b7
psql:q.sql:168: INFO:  uuid = 10c8c7aa-1367-44fa-ac76-a0f9b1ca69b7
psql:q.sql:168: INFO:  uuid = 10c8c7aa-1367-44fa-ac76-a0f9b1ca69b7
psql:q.sql:168: INFO:  uuid = 10c8c7aa-1367-44fa-ac76-a0f9b1ca69b7
psql:q.sql:168: INFO:  uuid = 10c8c7aa-1367-44fa-ac76-a0f9b1ca69b7
psql:q.sql:168: INFO:  uuid = 10c8c7aa-1367-44fa-ac76-a0f9b1ca69b7
psql:q.sql:168: INFO:  uuid = abc4884d-273e-49ce-82aa-46226af549c3
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 5d5fce48-987a-46e9-ac03-e567e703aafb
psql:q.sql:168: INFO:  uuid = 6c3da39d-467e-484c-9b68-6a20f8980c3a
psql:q.sql:168: INFO:  uuid = 6c3da39d-467e-484c-9b68-6a20f8980c3a
psql:q.sql:168: INFO:  uuid = 6c3da39d-467e-484c-9b68-6a20f8980c3a
psql:q.sql:168: INFO:  uuid = 6c3da39d-467e-484c-9b68-6a20f8980c3a
psql:q.sql:168: INFO:  uuid = 6c3da39d-467e-484c-9b68-6a20f8980c3a
psql:q.sql:168: INFO:  uuid = 6c3da39d-467e-484c-9b68-6a20f8980c3a
psql:q.sql:168: INFO:  uuid = 6c3da39d-467e-484c-9b68-6a20f8980c3a
psql:q.sql:168: INFO:  uuid = 6c3da39d-467e-484c-9b68-6a20f8980c3a
psql:q.sql:168: INFO:  uuid = 754268bc-411d-48dd-b68d-5b449c18ecab
psql:q.sql:168: INFO:  uuid = a0ae6b93-adec-4523-b422-8eba041d76de
-----

-------------------
My home system is Pentium D 3.2 hz 2g ram (NON-xeon!)

psql:q.sql:168: INFO:  uuid = 5dce8d5f-0f36-40fc-a34c-af74991e7fb3
psql:q.sql:168: INFO:  uuid = ae9b28c3-1614-4092-93dd-ba1d8392622c
psql:q.sql:168: INFO:  uuid = ae9b28c3-1614-4092-93dd-ba1d8392622c
psql:q.sql:168: INFO:  uuid = 14146307-231e-4feb-aa97-a709f6515d05
psql:q.sql:168: INFO:  uuid = 6a70d36c-de75-44ca-947b-3785eac42d49
psql:q.sql:168: INFO:  uuid = 6a70d36c-de75-44ca-947b-3785eac42d49
psql:q.sql:168: INFO:  uuid = 849650aa-1004-4c28-b7b5-dce9bcff22e4
psql:q.sql:168: INFO:  uuid = f950d8d9-c257-41cc-8206-7267698755f1
psql:q.sql:168: INFO:  uuid = f950d8d9-c257-41cc-8206-7267698755f1
psql:q.sql:168: INFO:  uuid = f950d8d9-c257-41cc-8206-7267698755f1
psql:q.sql:168: INFO:  uuid = df203405-a3d9-40b8-8195-46cdc7a9aa09
psql:q.sql:168: INFO:  uuid = c7ac43bc-2355-4c4d-9b61-defefead41e1
psql:q.sql:168: INFO:  uuid = c7ac43bc-2355-4c4d-9b61-defefead41e1
psql:q.sql:168: INFO:  uuid = e6a40257-5095-441a-8216-4802b8ccceca
psql:q.sql:168: INFO:  uuid = d10df458-a372-4ff8-85f5-c6fb8bcdf798
psql:q.sql:168: INFO:  uuid = d10df458-a372-4ff8-85f5-c6fb8bcdf798
psql:q.sql:168: INFO:  uuid = d10df458-a372-4ff8-85f5-c6fb8bcdf798
psql:q.sql:168: INFO:  uuid = 3ff3189b-cbe9-4e7f-b76e-0953337242b1
psql:q.sql:168: INFO:  uuid = 210a9418-1e19-4bec-b7ca-a0333d7dbb02
psql:q.sql:168: INFO:  uuid = 210a9418-1e19-4bec-b7ca-a0333d7dbb02
psql:q.sql:168: INFO:  uuid = 68bfec27-6f9d-49c7-93fc-4218a1d32e18
psql:q.sql:168: INFO:  uuid = ef86cb1b-2721-4a74-ba21-64fe5148c9d7
psql:q.sql:168: INFO:  uuid = ef86cb1b-2721-4a74-ba21-64fe5148c9d7
psql:q.sql:168: INFO:  uuid = ef86cb1b-2721-4a74-ba21-64fe5148c9d7
psql:q.sql:168: INFO:  uuid = 45141a17-9972-4013-92f2-ced9215f45b5
psql:q.sql:168: INFO:  uuid = 7c6cbb39-af9f-4de6-b6f8-0ae57bf0ea4f
psql:q.sql:168: INFO:  uuid = 7c6cbb39-af9f-4de6-b6f8-0ae57bf0ea4f
psql:q.sql:168: INFO:  uuid = 59d4c7ff-598d-49ae-9a95-a4051c2b5787



-----Original Message-----
From: Hiroshi Saito [mailto:z-saito(at)guitar(dot)ocn(dot)ne(dot)jp] 
Sent: Tuesday, July 01, 2008 4:56 PM
To: Eric P. Melbardis
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #4274: uuid returns duplicate values

Hi.

Umm...
The test of my box is comfortable. 

--
-- ossp-uuid test
--
CREATE OR REPLACE FUNCTION test_uuid(gen INTEGER)
  RETURNS VOID AS $$
BEGIN
 FOR i IN 1..$1 LOOP
  RAISE INFO 'uuid = %', uuid_generate_v4();
 END LOOP;
END;
$$
LANGUAGE 'plpgsql';

postgres=# CREATE OR REPLACE FUNCTION test_uuid(gen INTEGER)
postgres-#   RETURNS VOID AS $$
postgres$# BEGIN
postgres$#  FOR i IN 1..$1 LOOP
postgres$#   RAISE INFO 'uuid = %', uuid_generate_v4();
postgres$#  END LOOP;
postgres$# END;
postgres$# $$
postgres-# LANGUAGE 'plpgsql';
CREATE FUNCTION
postgres=# SELECT test_uuid(10);
INFO:  uuid = 427c6f3e-9876-48c5-b44d-776771f7c2c9
INFO:  uuid = fbab93a8-44d2-4f52-b6ae-01396c6ee17e
INFO:  uuid = d82be630-d2e8-4662-b6ea-db8c56121024
INFO:  uuid = 33689404-2da8-4a8d-9b94-6aeb284be347
INFO:  uuid = cd7d10b7-23fa-40df-af74-53314dae235c
INFO:  uuid = 80934b57-4cf4-4ab5-b915-f41f22054265
INFO:  uuid = abd6f205-1a49-4f4f-b854-c7d611533401
INFO:  uuid = 2dd64cbc-ee86-419e-ba09-ae538f60cc5a
INFO:  uuid = 751ee0fe-d5ae-473f-b22f-e14c9066fadd
INFO:  uuid = 0d36e47d-c065-4717-96f0-82f53f610a9a
 test_uuid
-----------

(1 row)

Regards,
Hiroshi Saito

----- Original Message ----- 
From: "Eric P. Melbardis" <eric(dot)melbardis(at)netkitsolutions(dot)com>


Hi

I just tried it, slightly better but not a runner....

Here is a sample of the results I get when running my test script, note
result vary but lack of duplicates does not.

Why do you not use the CreateUUID function in windows??

Regards

Eric

------------------------ result ------------------------------------

psql:q.sql:152: NOTICE:  uuid = dfde33d4-188a-4124-847d-0871a90be1fa
psql:q.sql:152: NOTICE:  uuid = dfde33d4-188a-4124-847d-0871a90be1fa
psql:q.sql:152: NOTICE:  uuid = e6e5dd64-5a1b-4f2e-8443-829d3b325247
psql:q.sql:152: NOTICE:  uuid = 2bb08ab3-eb57-42a3-a9ac-63e466384d71


-----Original Message-----
From: Hiroshi Saito [mailto:z-saito(at)guitar(dot)ocn(dot)ne(dot)jp] 
Sent: Sunday, June 29, 2008 3:22 PM
To: Eric P. Melbardis
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #4274: uuid returns duplicate values

Hi.

I'm sorry delaying release bugfix was not included in pg8.3.3. 
Please try this. 
http://winpg.jp/~saito/pg_work/OSSP_win32/

Regards,
Hiroshi Saito

>
>The following bug has been logged online:
>
>Bug reference:      4274
>Logged by:          eric melbardis
>Email address:      eric(dot)melbardis(at)netkitsolutions(dot)com
>PostgreSQL version: 8.3.3
>Operating system:   windows xp sp3
>Description:        uuid returns duplicate values
>Details: 
>
>the uuid functions do not return unique values if used sequntially, or
i
>believe without too much tme in between invocations.
>
>the following test functions returns the same value!
>
>------------ test function ---------------
>create or replace function test_uuid()
>returns varchar as 
>$body$
>begin
>    raise notice 'uuid = %', uuid_generate_v4();
>    raise notice 'uuid = %', uuid_generate_v4();
>    raise notice 'uuid = %', uuid_generate_v4();
>    raise notice 'uuid = %', uuid_generate_v4();
>end;
>$body$
>language 'plpgsql' ;
>
>-- 
>Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
>To make changes to your subscription:
>http://www.postgresql.org/mailpref/pgsql-bugs

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2008-07-02 14:19:51
Subject: Re: psql: FATAL: the database system is starting up
Previous:From: Hiroshi SaitoDate: 2008-07-01 23:55:43
Subject: Re: BUG #4274: uuid returns duplicate values

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group