Index of /code/PostgreSQL/y_uuid

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[   ]LICENSE20-Oct-2006 21:21 1.4K 
[   ]Makefile06-Mar-2008 10:46 2.2K 
[TXT]README.html19-Jan-2007 06:13 3.3K 
[TXT]y_uuid.c19-Oct-2007 21:19 5.4K 
[   ]y_uuid.sql20-Oct-2006 21:21 2.6K 

README

PostgreSQL Universally Unique Identifier (UUID) Functions

Links to the Universally Unique ID library created by Theodore Y. Ts'o (which is dual licensed: GPL/LGPL) to provide PostgreSQL C functions for generating UUID's (aka GUID's) as bytea values. Also provides a function to unparse the bytea values into their standard hexadecimal representation, a function to parse the standard hexadecimal representation into the corresponding bytea value, and a function to extract the time portion of time-based UUID's.

The Makefile implements the standard PostgreSQL PGXS build infrastructure. Run 'make' and 'make install' with appropriate permissions to build and install y_uuid.so. Execute the SQL calls in y_uuid.sql to create the functions within your database.

Contains the following functions:

The y_uuid_time function returns GMT time, which is the same as the UUID C library function. Note that the precision of the timestamp returned by y_uuid_time depends on whether the PostgreSQL architecture internally represents timestamps as INT64 values or floats (a compile time option).

Examples:

% select y_uuid_unparse( y_uuid_generate() );
           y_uuid_unparse
--------------------------------------
 0bf56bb1-1e47-472f-82a8-cc8134d23d91


% select y_uuid_unparse( y_uuid_generate_random() );
           y_uuid_unparse
--------------------------------------
 8e239390-1bd2-4b01-9ad9-8b3f0cfbb5b5


% select y_uuid_unparse( y_uuid_generate_time() );
           y_uuid_unparse
--------------------------------------
 e3a3a694-5e43-11db-82ad-0014bf7c74ed


% select y_uuid_unparse( y_uuid_parse( 'e3a3a694-5e43-11db-82ad-0014bf7c74ed' ) );
           y_uuid_unparse
--------------------------------------
 e3a3a694-5e43-11db-82ad-0014bf7c74ed


% select y_uuid_time( y_uuid_generate_time() );
         y_uuid_time
----------------------------
 2006-10-20 20:59:56.381406

TODO: Add sanity checking clauses where appropriate.


More Yellowbank Code.


Last modified: Fri Jan 19 06:13:18 EST 2007