
Allow the contrib/uuid-ossp extension to be built atop any one of these three popular UUID libraries. (The extension's name is now arguably a misnomer, but we'll keep it the same so as not to cause unnecessary compatibility issues for users.) We would not normally consider a change like this post-beta1, but the issue has been forced by our upgrade to autoconf 2.69, whose more rigorous header checks are causing OSSP's header files to be rejected on some platforms. It's been foreseen for some time that we'd have to move away from depending on OSSP UUID due to lack of upstream maintenance, so this is a down payment on that problem. While at it, add some simple regression tests, in hopes of catching any major incompatibilities between the three implementations. Matteo Beccati, with some further hacking by me
23 lines
849 B
SQL
23 lines
849 B
SQL
CREATE EXTENSION "uuid-ossp";
|
|
|
|
SELECT uuid_nil();
|
|
SELECT uuid_ns_dns();
|
|
SELECT uuid_ns_url();
|
|
SELECT uuid_ns_oid();
|
|
SELECT uuid_ns_x500();
|
|
|
|
SELECT uuid_generate_v1() < uuid_generate_v1();
|
|
SELECT uuid_generate_v1() < uuid_generate_v1mc();
|
|
|
|
SELECT substr(uuid_generate_v1()::text, 25) = substr(uuid_generate_v1()::text, 25);
|
|
SELECT substr(uuid_generate_v1()::text, 25) <> substr(uuid_generate_v1mc()::text, 25);
|
|
SELECT substr(uuid_generate_v1mc()::text, 25) <> substr(uuid_generate_v1mc()::text, 25);
|
|
|
|
SELECT ('x' || substr(uuid_generate_v1mc()::text, 25, 2))::bit(8) & '00000011';
|
|
|
|
SELECT uuid_generate_v3(uuid_ns_dns(), 'www.widgets.com');
|
|
SELECT uuid_generate_v5(uuid_ns_dns(), 'www.widgets.com');
|
|
|
|
SELECT uuid_generate_v4()::text ~ '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$';
|
|
SELECT uuid_generate_v4() <> uuid_generate_v4();
|