INFORMATION_SCHEMA.routines column routine_definition does not show the source - Mailing list pgsql-bugs

From Erki Eessaar
Subject INFORMATION_SCHEMA.routines column routine_definition does not show the source
Date
Msg-id AM9PR01MB8268D5CDABDF044EE9F42173FE8C9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com
Whole thread Raw
Responses Re: INFORMATION_SCHEMA.routines column routine_definition does not show the source
List pgsql-bugs
Hello

PostgreSQL 14 added the feature: "Allow SQL-language functions and procedures to use SQL-standard function bodies."

Unfortunately the bodies of such routines are not visible in the column routine_definition of the view INFORMATION_SCHEMA.routines. In case of these routines the field contains the empty string instead of the routine body.


Please observe the difference:

START TRANSACTION;

CREATE OR REPLACE FUNCTION f_fahrenheit_celsius_old(numeric) RETURNS numeric AS $$
SELECT round((($1 - 32.0) * 5.0 / 9.0),3); $$ LANGUAGE sql
IMMUTABLE STRICT LEAKPROOF;

CREATE OR REPLACE FUNCTION f_fahrenheit_celsius_new(numeric) RETURNS numeric
LANGUAGE sql IMMUTABLE STRICT LEAKPROOF
RETURN round((($1 - 32.0) * 5.0 / 9.0),3);

SELECT
routine_schema,
routine_name,
routine_definition
FROM INFORMATION_SCHEMA.routines
WHERE routine_name IN ('f_fahrenheit_celsius_old','f_fahrenheit_celsius_new');

ROLLBACK;

Best regards
Erki Eessaar

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17270: Partitions are not prunned for generic plans when `ANY` construct is used.
Next
From: "David G. Johnston"
Date:
Subject: Re: INFORMATION_SCHEMA.routines column routine_definition does not show the source