Search Postgresql Archives

Re: uuid c function contrib

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 17, 2006 at 03:25:05PM -0400, Ron Peterson wrote:

> I've written some PostgreSQL C functions which expose the functionality
> of Theodore Ts'o's UUID library.  I need to add a few sanity clauses
> here and there, but working (mostly) code can be found here:
> 
> http://www.yellowbank.com/code/PostgreSQL/uuid/

> I have one problem.  My y_uuid_time function works on my laptop
> (Kubuntu/Dapper), but not on another box (Debian Sarge).

The usual remedy of walking away from the problem and coming back fresh
helped me realize my stupid mistake.  I still believe in sanity clauses,
so I have a little more finessing to do, but the posted code works.

Implements uuid_generation functions which return bytea values, a
function to convert the bytea values to the canonical hex form, and a
function to extract the time from time-based uuids.  If you can use
this, please do.

Examples:

rpeterso=# select y_uuid_to_hex( y_uuid_generate() );
            y_uuid_to_hex
--------------------------------------
 0bf56bb1-1e47-472f-82a8-cc8134d23d91
(1 row)

rpeterso=# select y_uuid_to_hex( y_uuid_generate_random() );
            y_uuid_to_hex
--------------------------------------
 8e239390-1bd2-4b01-9ad9-8b3f0cfbb5b5
(1 row)

rpeterso=# select y_uuid_to_hex( y_uuid_generate_time() );
            y_uuid_to_hex
--------------------------------------
 e3a3a694-5e43-11db-82ad-0014bf7c74ed
(1 row)

rpeterso=# select y_uuid_time( y_uuid_generate_time() );
        y_uuid_time
----------------------------
 2006-10-17 20:59:25.101671

Best.

-- 
Ron Peterson
https://www.yellowbank.com/



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux