Skip site navigation (1) Skip section navigation (2)

Re: [PATCH] "\ef <function>" in psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Abhijit Menon-Sen <ams(at)oryx(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, gavin(at)alcove(dot)com(dot)au
Subject: Re: [PATCH] "\ef <function>" in psql
Date: 2008-09-06 00:10:47
Message-ID: 7196.1220659847@sss.pgh.pa.us (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-hackers
Abhijit Menon-Sen <ams(at)oryx(dot)com> writes:
> I have attached two patches:
> - funcdef.diff implements pg_get_functiondef()
> - edit.diff implements "\ef function" in psql based on (1).

I've applied this with some corrections (mostly around proper quoting)
and some outright editorialization:

* the psql command seemed to have some ideas about supplying a blank
CREATE OR REPLACE FUNCTION command for a nonexistent function, but this
didn't actually work.  In any case it seemed poorly thought out, because
you'd really need to pay some attention to *why* the regproc/regprocedure
lookup failed.  I just ripped it out for the moment.  I'm not averse to
the concept, if you can get it implemented properly.

* the way you had it set up, the CREATE OR REPLACE FUNCTION command
would be sent to the backend instantaneously upon return from the
editor, with no opportunity for the user to decide he didn't want his
changes applied.  This seemed unacceptably dangerous to me.  I changed
the exit code to PSQL_CMD_NEWEDIT instead of PSQL_CMD_SEND, which causes
the command to wait in the query buffer.  Unfortunately there's no
visual indication of that, other than a small change in the prompt
status.  It'd likely be better if we could get libreadline to redisplay
the query buffer contents --- anyone have an idea how to do that?
(I have some vague recollection that \e used to work that way, though
it definitely fails to do so now.)

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2008-09-06 00:24:37
Subject: Re: reducing statistics write overhead
Previous:From: Euler Taveira de OliveiraDate: 2008-09-05 23:29:50
Subject: Re: reducing statistics write overhead

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group