Re: INFORMATION_SCHEMA.routines column routine_definition does not show the source

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: INFORMATION_SCHEMA.routines column routine_definition does not show the source
Date: 2021-11-03 16:46:38
Message-ID: 134216.1635957998@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> The information schema query consults pg_proc.prosrc directly instead of
> calling pg_get_functiondef(...) (which didn't exist when the original query
> was written, and hasn't been wrong until now).

pg_get_functiondef would produce more than we want, but it looks like
pg_get_function_sqlbody() would do.

BTW, while researching this I noted the header comment for
pg_get_functiondef:

* Note: if you change the output format of this function, be careful not
* to break psql's rules (in \ef and \sf) for identifying the start of the
* function body. To wit: the function body starts on a line that begins
* with "AS ", and no preceding line will look like that.

Needless to say, the SQL-function-body patch has ignored this advice
totally. At the very least this comment needs to be adjusted, but
I wonder if it's not telling us that \ef and/or \sf are broken.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ian Campbell 2021-11-03 17:39:52 range_agg() missing support for multirange inputs
Previous Message Peter Geoghegan 2021-11-03 16:21:20 Re: BUG #17257: (auto)vacuum hangs within lazy_scan_prune()