INFORMATION_SCHEMA.routine_column_usage
Hello
Here
https://www.postgresql.org/docs/current/infoschema-routine-column-usage.html
it is stated that "The view routine_column_usage is meant to identify all columns that are used by a function or procedure. This information is currently not tracked by PostgreSQL."
However, this claim is incorrect because the view provides information about the column usage of SQL functions that have SQL-standard function body.
CREATE TABLE Person (person_id SERIAL,
given_name VARCHAR(50) NOT NULL,
reg_time TIMESTAMP(0) NOT NULL DEFAULT LOCALTIMESTAMP(0),
CONSTRAINT pk_person PRIMARY KEY (person_id));
CREATE FUNCTION f_reg_person(p_given_name Person.given_name%TYPE)
RETURNS Person.person_id%TYPE
LANGUAGE SQL SECURITY DEFINER
BEGIN ATOMIC
INSERT INTO Person (given_name) VALUES (p_given_name)
RETURNING person_id;
END;
SELECT * FROM Information_schema.routine_column_usage;
Returns information about two columns - person_id and given_name.
Perhaps the better wording is:
The view routine_column_usage is meant to identify all columns that are used by a function or procedure. This information is tracked by PostgreSQL in case of routines that have SQL-standard function body.
Best regards
Erki Eessaar
Here
https://www.postgresql.org/docs/current/infoschema-routine-column-usage.html <https://www.postgresql.org/docs/current/infoschema-routine-column-usage.html>it is stated that "The view |routine_column_usage| is meant to identify
all columns that are used by a function or procedure. This information
is currently not tracked by PostgreSQL."However, this claim is incorrect because the view provides information
about the column usage of SQL functions that have SQL-standard function
body.
Correct, the documentation was not updated when this was added. A few
other views are similarly affected. How about this attached patch.
Attachments:
0001-doc-Update-info-on-information-schema-usage-tables.patchtext/plain; charset=UTF-8; name=0001-doc-Update-info-on-information-schema-usage-tables.patchDownload+16-15
On 29.11.23 15:01, Peter Eisentraut wrote:
Here
https://www.postgresql.org/docs/current/infoschema-routine-column-usage.html <https://www.postgresql.org/docs/current/infoschema-routine-column-usage.html>it is stated that "The view |routine_column_usage| is meant to
identify all columns that are used by a function or procedure. This
information is currently not tracked by PostgreSQL."However, this claim is incorrect because the view provides information
about the column usage of SQL functions that have SQL-standard
function body.Correct, the documentation was not updated when this was added. A few
other views are similarly affected. How about this attached patch.
Fix committed.