summaryrefslogtreecommitdiff
path: root/contrib/uuid-ossp/uuid-ossp.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/uuid-ossp/uuid-ossp.c')
-rw-r--r--contrib/uuid-ossp/uuid-ossp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/uuid-ossp/uuid-ossp.c b/contrib/uuid-ossp/uuid-ossp.c
index 7c0fb812fd7..456a43884cd 100644
--- a/contrib/uuid-ossp/uuid-ossp.c
+++ b/contrib/uuid-ossp/uuid-ossp.c
@@ -285,6 +285,18 @@ uuid_generate_internal(int v, unsigned char *ns, const char *ptr, int len)
strlcpy(strbuf, str, 37);
/*
+ * In recent NetBSD, uuid_create() has started
+ * producing v4 instead of v1 UUIDs. Check the
+ * version field and complain if it's not v1.
+ */
+ if (strbuf[14] != '1')
+ ereport(ERROR,
+ (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
+ /* translator: %c will be a hex digit */
+ errmsg("uuid_create() produced a version %c UUID instead of the expected version 1",
+ strbuf[14])));
+
+ /*
* PTR, if set, replaces the trailing characters of
* the uuid; this is to support v1mc, where a random
* multicast MAC is used instead of the physical one