summaryrefslogtreecommitdiff
path: root/shared/ossp_uuid/pgsql/uuid.txt
blob: c9506de4f53c2906f1ce72fd4f43a39bf9f024dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

  OSSP uuid bindings for PostgreSQL
  =================================

  This is the OSSP uuid binding for the PostgreSQL RDBMS, providing
  native UUID data type support.

  Installation
  ------------

  In order to install the OSSP uuid binding into the PostgreSQL database
  <database> one has run:

  $ <prefix>/bin/psql \
    -d <database> \
    -U postgresql \
    -f <prefix>/share/postgresql/uuid.sql

  Usage
  -----

  psql -d <database>
  psql> CREATE TABLE test (id UUID DEFAULT uuid(1), name TEXT);
  psql> INSERT INTO test (name) VALUES
        ('foo');
  psql> INSERT INTO test (id, name) VALUES
        (uuid(1), 'bar');
  psql> INSERT INTO test (id, name) VALUES
        (uuid(3, 'ns:URL', 'http://www.ossp.org/'), 'baz');
  psql> INSERT INTO test (id, name) VALUES
        (uuid(3, '6ba7b811-9dad-11d1-80b4-00c04fd430c8',
                 'http://www.ossp.org/'), 'quux');
  psql> SELECT uuid(4);
  psql> SELECT * FROM test WHERE id = uuid(3, 'ns:URL', 'http://www.ossp.org/');
  psql> DROP TABLE test;

bgstack15