Re: review: psql: edit function, show function commands patch

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Jan Urbański <wulczer(at)wulczer(dot)org>, Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: psql: edit function, show function commands patch
Date: 2010-08-09 10:51:08
Message-ID: AANLkTiny4JEQmTBJv2n5XHtdo928W5aoiwJ+bzG_TfOm@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 8, 2010 at 11:38 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Um, but \sf *doesn't* give you anything that's usefully copy and
> pasteable.

Works for me.

\sf ts_debug(regconfig, text)

> And if that were the goal, why doesn't it have an option to
> write to a file?

Well, you cut-and-paste from a terminal window, not a file, so that's
a slightly different problem, although perhaps also a good one to
solve. But I'd rather see us solve that problem via some new pg_dump
functionality.

Hmm... or perhaps \sf should respect \o. I notice that \d does.

> But it's really the line numbers shoved in front that I'm on about here.
> I can't see *any* use for that behavior except to figure out what part of
> your function an error message with line number is referring to; and as
> I said upthread, there are better ways to be attacking that problem.
> If you've got a thousand-line function (yes, they're out there) do you
> really want to be scrolling through \sf output to find out what line 714
> is?

Well, as Pavel points out, I guess you could use the "line number"
argument to \sf to start at around the place you're interested in,
athough I suspect that I would probably choose to use \ef in that
case. I suspect \sf is in general most useful with somewhat shorter
functions (I'd copy and paste a 100 line function, perhaps, but for a
1000 line function I'd probably try to get the definition into a file
and scp it or whatever).

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2010-08-09 11:40:40 Re: review: psql: edit function, show function commands patch
Previous Message Pavel Stehule 2010-08-09 10:18:33 is syntax columname(tablename) necessary still?