I have a postgresql 9 installation on windows, which doesn't have built in uuid generator. There is OSSD package, which can be bound to postgresql as uuid generator, but it's for *nix only (I think).
How can I generate uuid in windows postgresql?
Unfortunately, while PostgreSQL is great for storing and comparing UUID data, it lacks capabilities for creating UUID values in its core. Instead, it relies on third-party modules to create UUIDs using specified techniques.
Any time a row is inserted into this table, the id value will be an auto-generated UUID.
What is the Postgres UUID Type? The Postgres UUID data type stores UUIDs as defined by RFC 4122, which are 128-bit quantities generated by algorithms that minimize the probability of having duplicate identifiers. A UUID comprises of 32 hexadecimal digits, represented in groups of 8,4,4,4 and 12.
The uuid-ossp module provides functions to generate universally unique identifiers (UUIDs) using one of several standard algorithms. There are also functions to produce certain special UUID constants. This module is only necessary for special requirements beyond what is available in core PostgreSQL.
The one-click installer from EnterpriseDB does have it. The DLL is called "uuid-ossp.dll" and resides in "(Postgres' installation directory)\lib" and the installation SQL script is called "uuid-ossp.sql" and resides in "(Postgres' installation directory)\share\contrib". You have to execute the last one in the DB of your choice.
The uuid-ossp-module in the contrib, does work on Windows XP 32 bits. The 64 bits version is not available yet, the OSSP UUID library project has to fix this problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With