X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=postgres%2FREADME;h=678e63cef759c9855a4ad469dade234e7425cecc;hb=HEAD;hp=9d0fd919d8e6947fcc517efdfbc21b9819bc4fd6;hpb=c7e13d717c38e528ae241bf5facb51bca63f323c;p=uuid diff --git a/postgres/README b/postgres/README index 9d0fd91..678e63c 100644 --- a/postgres/README +++ b/postgres/README @@ -1,6 +1,6 @@ This software package is an addon module for postgres. It supplies -support functions for the built-in uuid data type. It was built and -tested against postgres version 8.4.0. This file and all supplied files +support functions for the built-in uuid data type. It was originally built and +tested against postgres version 8.4.0. This file and all supplied files are written by Nathan Wagner and placed in the public domain. Bug reports to nw@hydaspes.if.org. @@ -8,12 +8,11 @@ Credit: the hash functions are stripped down implementations from libtomcrypt by Tom St Denis, also in the public domain. Functions supplied are uuid generation functions, conforming (with -one exception) to RFC 4122. The exception lies in the multicast -bit +one exception) to RFC 4122 (see below for details). Features: -UUID generation functions for version 1, 3, 4, and 5 UUIDS. +UUID generation functions for version 1, 3, 4, and 5 uuids. RFC 4122 compliance, with the exception of the multicast bit for randomly generated mac addresses. This module sets the correct @@ -30,11 +29,25 @@ issues. Compiles with the usual postgres addon infrastructure. make make install + +The 'make install' step will need sufficient privileges to write +to the Postgres extension directory, so 'sudo make install' +might be needed. + +Installation can be done via the usual Postgres extension mechanism. +create extension pduuid; + +The extension is re-locatable, so you can specify a schema if you +like. + +Installation can be done manually with: + psql -f uuid.sql psql -f uninstall-uuid.sql A pure postgres implementation is also supplied of just the generation -functions in purepguuid.sql. +functions in purepguuid.sql, though this is very inefficient, feature +incomplete, and untested. It's there if you need it though. Generation Functions: @@ -54,7 +67,7 @@ returns a version 4 uuid. This is a random uuid. The odds of collision are vanishingly low and it is safe to use for regular production uuid generation. -uuid_v3(uuid, text) +uuid_v5(uuid, text) returns a version 5 uuid using the supplied namespace uuid and the given input string. This is an sha1 based uuid. @@ -106,6 +119,9 @@ network byte order for the subfields of a uuid, where applicable. Numeric: treats the UUID as a 128 bit number and converts it to a numeric. Bit(128) and bit varying: treats the uuid as a 128 bit vector. +Casts to bit(n) where n is shorter than 128 will truncate +the uuid. Where n is longer than 128, the bit vector +will be zero extended. Field extraction functions: