diff --git a/contrib/uuid-ossp/Makefile b/contrib/uuid-ossp/Makefile
index c52c583d648..48d2523d4a4 100644
--- a/contrib/uuid-ossp/Makefile
+++ b/contrib/uuid-ossp/Makefile
@@ -4,7 +4,8 @@ MODULE_big = uuid-ossp
 OBJS = uuid-ossp.o $(UUID_EXTRA_OBJS) $(WIN32RES)
 
 EXTENSION = uuid-ossp
-DATA = uuid-ossp--1.1.sql uuid-ossp--1.0--1.1.sql uuid-ossp--unpackaged--1.0.sql
+DATA = uuid-ossp--1.2.sql uuid-ossp--1.1--1.2.sql uuid-ossp--1.0--1.1.sql \
+       uuid-ossp--unpackaged--1.0.sql
 PGFILEDESC = "uuid-ossp - UUID generation"
 
 REGRESS = uuid_ossp
diff --git a/contrib/uuid-ossp/expected/uuid_ossp.out b/contrib/uuid-ossp/expected/uuid_ossp.out
index 409c885c33a..1c54c6ef129 100644
--- a/contrib/uuid-ossp/expected/uuid_ossp.out
+++ b/contrib/uuid-ossp/expected/uuid_ossp.out
@@ -118,12 +118,24 @@ SELECT uuid_generate_v3(uuid_ns_dns(), 'www.widgets.com');
  3d813cbb-47fb-32ba-91df-831e1593ac29
 (1 row)
 
+SELECT uuid_generate_v3(uuid_nil(), '\x00ABCDEF'::bytea);
+           uuid_generate_v3           
+--------------------------------------
+ ab97c525-de95-3d08-a34a-bdb16bda93ca
+(1 row)
+
 SELECT uuid_generate_v5(uuid_ns_dns(), 'www.widgets.com');
            uuid_generate_v5           
 --------------------------------------
  21f7f8de-8051-5b89-8680-0195ef798b6a
 (1 row)
 
+SELECT uuid_generate_v5(uuid_nil(), '\x00ABCDEF'::bytea);
+           uuid_generate_v5           
+--------------------------------------
+ c52b4615-61e8-522c-a42e-8feb48af3958
+(1 row)
+
 SELECT uuid_version_bits(uuid_generate_v4()),
        uuid_reserved_bits(uuid_generate_v4());
  uuid_version_bits | uuid_reserved_bits 
diff --git a/contrib/uuid-ossp/sql/uuid_ossp.sql b/contrib/uuid-ossp/sql/uuid_ossp.sql
index b4237df8847..f5f06d62260 100644
--- a/contrib/uuid-ossp/sql/uuid_ossp.sql
+++ b/contrib/uuid-ossp/sql/uuid_ossp.sql
@@ -67,7 +67,10 @@ SELECT uuid_node(uuid_generate_v1()) <> uuid_node(uuid_generate_v1mc());
 SELECT uuid_node(uuid_generate_v1mc()) <> uuid_node(uuid_generate_v1mc());
 
 SELECT uuid_generate_v3(uuid_ns_dns(), 'www.widgets.com');
+SELECT uuid_generate_v3(uuid_nil(), '\x00ABCDEF'::bytea);
+
 SELECT uuid_generate_v5(uuid_ns_dns(), 'www.widgets.com');
+SELECT uuid_generate_v5(uuid_nil(), '\x00ABCDEF'::bytea);
 
 SELECT uuid_version_bits(uuid_generate_v4()),
        uuid_reserved_bits(uuid_generate_v4());
diff --git a/contrib/uuid-ossp/uuid-ossp--1.1--1.2.sql b/contrib/uuid-ossp/uuid-ossp--1.1--1.2.sql
new file mode 100644
index 00000000000..687d628aa30
--- /dev/null
+++ b/contrib/uuid-ossp/uuid-ossp--1.1--1.2.sql
@@ -0,0 +1,14 @@
+/* contrib/uuid-ossp/uuid-ossp--1.1--1.2.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION uuid-ossp UPDATE TO '1.2'" to load this file. \quit
+
+CREATE FUNCTION uuid_generate_v3(namespace uuid, name bytea)
+RETURNS uuid
+AS 'MODULE_PATHNAME', 'uuid_generate_v3_bytea'
+IMMUTABLE STRICT LANGUAGE C PARALLEL SAFE;
+
+CREATE FUNCTION uuid_generate_v5(namespace uuid, name bytea)
+RETURNS uuid
+AS 'MODULE_PATHNAME', 'uuid_generate_v5_bytea'
+IMMUTABLE STRICT LANGUAGE C PARALLEL SAFE;
diff --git a/contrib/uuid-ossp/uuid-ossp--1.1.sql b/contrib/uuid-ossp/uuid-ossp--1.2.sql
similarity index 82%
rename from contrib/uuid-ossp/uuid-ossp--1.1.sql
rename to contrib/uuid-ossp/uuid-ossp--1.2.sql
index c9cefd73608..a9c211447db 100644
--- a/contrib/uuid-ossp/uuid-ossp--1.1.sql
+++ b/contrib/uuid-ossp/uuid-ossp--1.2.sql
@@ -43,6 +43,11 @@ RETURNS uuid
 AS 'MODULE_PATHNAME', 'uuid_generate_v3'
 IMMUTABLE STRICT LANGUAGE C PARALLEL SAFE;
 
+CREATE FUNCTION uuid_generate_v3(namespace uuid, name bytea)
+RETURNS uuid
+AS 'MODULE_PATHNAME', 'uuid_generate_v3_bytea'
+IMMUTABLE STRICT LANGUAGE C PARALLEL SAFE;
+
 CREATE FUNCTION uuid_generate_v4()
 RETURNS uuid
 AS 'MODULE_PATHNAME', 'uuid_generate_v4'
@@ -52,3 +57,8 @@ CREATE FUNCTION uuid_generate_v5(namespace uuid, name text)
 RETURNS uuid
 AS 'MODULE_PATHNAME', 'uuid_generate_v5'
 IMMUTABLE STRICT LANGUAGE C PARALLEL SAFE;
+
+CREATE FUNCTION uuid_generate_v5(namespace uuid, name bytea)
+RETURNS uuid
+AS 'MODULE_PATHNAME', 'uuid_generate_v5_bytea'
+IMMUTABLE STRICT LANGUAGE C PARALLEL SAFE;
diff --git a/contrib/uuid-ossp/uuid-ossp.c b/contrib/uuid-ossp/uuid-ossp.c
index 1ce08555cfb..8e9f5e825d1 100644
--- a/contrib/uuid-ossp/uuid-ossp.c
+++ b/contrib/uuid-ossp/uuid-ossp.c
@@ -123,8 +123,10 @@ PG_FUNCTION_INFO_V1(uuid_ns_x500);
 PG_FUNCTION_INFO_V1(uuid_generate_v1);
 PG_FUNCTION_INFO_V1(uuid_generate_v1mc);
 PG_FUNCTION_INFO_V1(uuid_generate_v3);
+PG_FUNCTION_INFO_V1(uuid_generate_v3_bytea);
 PG_FUNCTION_INFO_V1(uuid_generate_v4);
 PG_FUNCTION_INFO_V1(uuid_generate_v5);
+PG_FUNCTION_INFO_V1(uuid_generate_v5_bytea);
 
 #ifdef HAVE_UUID_OSSP
 
@@ -515,6 +517,21 @@ uuid_generate_v3(PG_FUNCTION_ARGS)
 
 
 Datum
+uuid_generate_v3_bytea(PG_FUNCTION_ARGS)
+{
+	pg_uuid_t  *ns = PG_GETARG_UUID_P(0);
+	bytea	   *name = PG_GETARG_BYTEA_PP(1);
+
+#ifdef HAVE_UUID_OSSP
+	return uuid_generate_v35_internal(UUID_MAKE_V3, ns, name);
+#else
+	return uuid_generate_internal(UUID_MAKE_V3, (unsigned char *) ns,
+								  VARDATA_ANY(name), VARSIZE_ANY_EXHDR(name));
+#endif
+}
+
+
+Datum
 uuid_generate_v4(PG_FUNCTION_ARGS)
 {
 	return uuid_generate_internal(UUID_MAKE_V4, NULL, NULL, 0);
@@ -534,3 +551,18 @@ uuid_generate_v5(PG_FUNCTION_ARGS)
 								  VARDATA_ANY(name), VARSIZE_ANY_EXHDR(name));
 #endif
 }
+
+
+Datum
+uuid_generate_v5_bytea(PG_FUNCTION_ARGS)
+{
+	pg_uuid_t  *ns = PG_GETARG_UUID_P(0);
+	bytea	   *name = PG_GETARG_BYTEA_PP(1);
+
+#ifdef HAVE_UUID_OSSP
+	return uuid_generate_v35_internal(UUID_MAKE_V5, ns, name);
+#else
+	return uuid_generate_internal(UUID_MAKE_V5, (unsigned char *) ns,
+								  VARDATA_ANY(name), VARSIZE_ANY_EXHDR(name));
+#endif
+}
diff --git a/contrib/uuid-ossp/uuid-ossp.control b/contrib/uuid-ossp/uuid-ossp.control
index 657476c182f..3479b06eff7 100644
--- a/contrib/uuid-ossp/uuid-ossp.control
+++ b/contrib/uuid-ossp/uuid-ossp.control
@@ -1,5 +1,5 @@
 # uuid-ossp extension
 comment = 'generate universally unique identifiers (UUIDs)'
-default_version = '1.1'
+default_version = '1.2'
 module_pathname = '$libdir/uuid-ossp'
 relocatable = true
diff --git a/doc/src/sgml/uuid-ossp.sgml b/doc/src/sgml/uuid-ossp.sgml
index 227d4a839c8..235e22578e1 100644
--- a/doc/src/sgml/uuid-ossp.sgml
+++ b/doc/src/sgml/uuid-ossp.sgml
@@ -58,7 +58,11 @@
       </entry>
      </row>
      <row>
-      <entry><function>uuid_generate_v3(namespace uuid, name text)</function><indexterm><primary>uuid_generate_v3</primary></indexterm></entry>
+      <entry>
+       <function>uuid_generate_v3(namespace uuid, name text)</function>
+       <function>uuid_generate_v3(namespace uuid, name bytea)</function>
+       <indexterm><primary>uuid_generate_v3</primary></indexterm>
+      </entry>
       <entry>
        <para>
         This function generates a version 3 UUID in the given namespace using
@@ -92,7 +96,11 @@ SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org');
       </entry>
      </row>
      <row>
-      <entry><literal>uuid_generate_v5(namespace uuid, name text)</literal></entry>
+      <entry>
+       <function>uuid_generate_v5(namespace uuid, name text)</function>
+       <function>uuid_generate_v5(namespace uuid, name bytea)</function>
+       <indexterm><primary>uuid_generate_v5</primary></indexterm>
+      </entry>
       <entry>
        <para>
         This function generates a version 5 UUID, which works like a version 3
