INFORMATION_SCHEMA.routine_column_usage

From: Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee>
To: "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: INFORMATION_SCHEMA.routine_column_usage
Date: 2023-11-24 11:04:09
Message-ID: AM9PR01MB8268EC7B696F9FE346CA5B93FEB8A@AM9PR01MB8268.eurprd01.prod.exchangelabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2023-11-24 17:29:19 Re: [DOCS] Add example about date ISO format
Previous Message PG Doc comments form 2023-11-23 20:51:53 "name" vs "alias" in datatype table