From: | Karim Nassar <Karim(dot)Nassar(at)NAU(dot)EDU> |
---|---|
To: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
Cc: | "Thomas F(dot)O'Connell" <tfo(at)sitening(dot)com>, Patrick Hatcher <PHatcher(at)macys(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: how to edit a function from psql? |
Date: | 2004-11-04 23:23:27 |
Message-ID: | 1099610607.2301.259.camel@denali.cse.nau.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Here is what I get:
orfs=# \df+ get_datasets
List of functions
Result data type | Schema | Name | Argument
data types | Owner | Language
| Source
code | Description
------------------+--------------+--------------+-------------------------------------------------+-------+----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------
refcursor | weather_data | get_datasets | refcursor, character
varying, character varying | kan4 | plpgsql |
DECLARE
_person_ ALIAS FOR $2;
_where_ ALIAS FOR $3;
selectstring text;
BEGIN
selectstring := get_datasets_selstr(_person_, _where_);
-- RAISE NOTICE '%', selectstring;
OPEN $1 FOR EXECUTE selectstring;
RETURN $1;
END;
|
(1 row)
orfs=# \e
CREATE FUNCTION
When I issue \e, the editor window pops up, apparently with the contents
of the query buffer. When I exit the editor, the function definition is
applied to create this function (the one in the buffer).
orfs=# \?
<snip>
Query Buffer
\e [FILE] edit the query buffer (or file) with external editor
\g [FILE] send query buffer to server (and results to file or
|pipe)
\p show the contents of the query buffer
\r reset (clear) the query buffer
\s [FILE] display history or save it to file
\w [FILE] write query buffer to file
<snip>
How did that function definition get in the query buffer? Seems that it
sure would be nice to fill it \df+...
\<.
On Thu, 2004-11-04 at 14:40, Alvaro Herrera wrote:
> On Thu, Nov 04, 2004 at 02:22:06PM -0600, Thomas F.O'Connell wrote:
> > To the best of my knowledge, this is not possible in psql.
> >
> > You can edit individual queries with \e, but I don't think it's
> > possible to edit functions.
>
> It is of course possible get the definition using \df+ and then use
> CREATE OR REPLACE in conjuntion with \e to edit it at will.
From | Date | Subject | |
---|---|---|---|
Next Message | Matt Clark | 2004-11-04 23:32:57 | Re: Restricting Postgres |
Previous Message | Matt Clark | 2004-11-04 23:22:22 | Re: Restricting Postgres |