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: 2022-12-02 01:28:39
Message-ID: 1744742.1669944519@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:
> Decided to ping this as I don't recall or see it getting patched and the
> recent discussion regarding the prosrc field.

>> * 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.

Indeed, if you experiment with "\sf+" or "\ef" with a line number,
those features fail miserably for new-style SQL functions.

We could partially fix that by teaching psql to also recognize
"BEGIN" as the start of the function body. I say "partially"
because the whole point of that line-numbers feature is so that
you can figure out which line an error report is complaining about.
However, SQL functions don't report in terms of line numbers,
and never have, so maybe that's moot. It's fortunate that they
don't, because the reconstructed function text is likely to have
different line breaks than the original.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2022-12-02 02:30:31 Re: hashing bpchar for nondeterministic collations is broken
Previous Message David G. Johnston 2022-12-02 00:00:05 Re: INFORMATION_SCHEMA.routines column routine_definition does not show the source