Unmark gen_random_uuid() function leakproof.
authorMasahiko Sawada <msawada@postgresql.org>
Wed, 11 Dec 2024 18:35:57 +0000 (10:35 -0800)
committerMasahiko Sawada <msawada@postgresql.org>
Wed, 11 Dec 2024 18:35:57 +0000 (10:35 -0800)
The functions without arguments don't need to be marked
leakproof. This commit unmarks gen_random_uuid() leakproof for
consistency with upcoming UUID generation functions. Also, this commit
adds a regression test to prevent reintroducing such cases.

Bump catalog version.

Reported-by: Peter Eisentraut
Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/CAD21AoBE1ePPWY1NQEgk3DkqjYzLPZwYTzCySHm0e%2B9a69PfZw%40mail.gmail.com

src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/test/regress/expected/opr_sanity.out
src/test/regress/sql/opr_sanity.sql

index 3ca5dbf9e839ec96af9af3447ed8b5bbf3ebfd8a..834b79c91bcd39935e569c4f5128e51ff30aaded 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     202412021
+#define CATALOG_VERSION_NO     202412111
 
 #endif
index 9575524007f75ca23689a3c86df940958f7ae37d..ccf79761da577bf49f0d9627adddfed4101c7219 100644 (file)
   proname => 'uuid_hash_extended', prorettype => 'int8',
   proargtypes => 'uuid int8', prosrc => 'uuid_hash_extended' },
 { oid => '3432', descr => 'generate random UUID',
-  proname => 'gen_random_uuid', proleakproof => 't', provolatile => 'v',
+  proname => 'gen_random_uuid', provolatile => 'v',
   prorettype => 'uuid', proargtypes => '', prosrc => 'gen_random_uuid' },
 { oid => '6342', descr => 'extract timestamp from UUID',
   proname => 'uuid_extract_timestamp', proleakproof => 't',
index 34a32bd11d219d7bc16f1a0d251964c7a501b555..b673642ad1d79053f0b1906812be67fb12fbecb0 100644 (file)
@@ -855,7 +855,6 @@ sha224(bytea)
 sha256(bytea)
 sha384(bytea)
 sha512(bytea)
-gen_random_uuid()
 starts_with(text,text)
 macaddr8_eq(macaddr8,macaddr8)
 macaddr8_lt(macaddr8,macaddr8)
@@ -878,6 +877,12 @@ crc32(bytea)
 crc32c(bytea)
 bytea_larger(bytea,bytea)
 bytea_smaller(bytea,bytea)
+-- Check that functions without argument are not marked as leakproof.
+SELECT p1.oid::regprocedure
+FROM pg_proc p1 JOIN pg_namespace pn
+     ON pronamespace = pn.oid
+WHERE nspname = 'pg_catalog' AND proleakproof AND pronargs = 0
+ORDER BY 1;
 -- restore normal output mode
 \a\t
 -- List of functions used by libpq's fe-lobj.c
index 2fe7b6dcc498668eb73823a6a689dc300b425515..2fb3a85287816f00fca60038150426083598fa38 100644 (file)
@@ -399,6 +399,13 @@ FROM pg_proc p1 JOIN pg_namespace pn
 WHERE nspname = 'pg_catalog' AND proleakproof
 ORDER BY 1;
 
+-- Check that functions without argument are not marked as leakproof.
+SELECT p1.oid::regprocedure
+FROM pg_proc p1 JOIN pg_namespace pn
+     ON pronamespace = pn.oid
+WHERE nspname = 'pg_catalog' AND proleakproof AND pronargs = 0
+ORDER BY 1;
+
 -- restore normal output mode
 \a\t