Re: potential extension of psql's \df+ ?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: potential extension of psql's \df+ ?
Date: 2017-04-19 10:00:04
Message-ID: CAFj8pRAU25fkSLMhkq5q9awjC8Bc3oWPd9LesvwmPVVbWDhdsA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

2017-04-19 11:55 GMT+02:00 Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>:

> Hi all !
>
> Every so often, when working with functions, errors get
> reported with context information similar to this:
>
> Context: PL/pgSQL function "test_function" line 5 at SQL statement
>
> Often, the function source is kept under version control (or
> in a file annotated, commented, etc in certain ways) such
> that the file line number does not correspond to the function
> source line number.
>
> In such cases, a typical approach would be to go and do
>
> \df+ test_function
>
> which nicely produces function metadata and source as
> contained in the database. For non-trivial functions it is,
> however, slightly cumbersome to count the line numbers
> onscreen (let alone line break settings).
>
> Hence I wonder whether an approach along these lines:
>
> select
> row_number() over ()
> || src_line
> from (
> select
> unnest(string_to_array(prosrc, E'\n')) as src_line
> from
> pg_proc
> where
> proname = 'FUNC_NAME'
> ) as func_src;
>
> would be a worthwhile change to the query "\df+" uses ?
>
>
do you know \sf+ fce command?

Regards

Pavel

> (Resorting to "\ef" won't align temp file lines with function
> source line numbers either, because pgsql boilerplate is
> needed for function definition etc.)
>
> Thanks for considering,
> Karsten
> --
> GPG key ID E4071346 @ eu.pool.sks-keyservers.net
> E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Samuel Williams 2017-04-19 10:12:31 Re: Large data and slow queries
Previous Message Karsten Hilbert 2017-04-19 09:55:22 potential extension of psql's \df+ ?