| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| LICENSE | 20-Oct-2006 21:21 | 1.4K | ||
| Makefile | 06-Mar-2008 10:46 | 2.2K | ||
| y_uuid.sql | 20-Oct-2006 21:21 | 2.6K | ||
| README.html | 19-Jan-2007 06:13 | 3.3K | ||
| y_uuid.c | 19-Oct-2007 21:19 | 5.4K | ||
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:
y_uuid_generate() returns bytea
y_uuid_generate_random() returns bytea
y_uuid_generate_time() returns bytea
y_uuid_unparse(bytea) returns text
y_uuid_parse(text) returns bytea
y_uuid_time(bytea) returns timestamp
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.