Unmark gen_random_uuid() function leakproof.

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
This commit is contained in:
Masahiko Sawada 2024-12-11 10:35:57 -08:00
parent 0e033f5b6d
commit 398d3e3b5b
4 changed files with 15 additions and 3 deletions

View File

@ -57,6 +57,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 202412021
#define CATALOG_VERSION_NO 202412111
#endif

View File

@ -9345,7 +9345,7 @@
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',

View 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

View 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