From: | Abhijit Menon-Sen <ams(at)oryx(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | psql: \edit-function <function-name> |
Date: | 2008-06-16 02:01:21 |
Message-ID: | 20080616020121.GA18941@toroid.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi.
I'm working on a patch where if you say "\ef foo" in psql, it'll start
$EDITOR with a "CREATE OR REPLACE FUNCTION" statement to recreate the
function. So you edit and save and quit, and if you made any changes,
psql will execute the statement.
The psql(/command.c) parts of this are quite simple. I've attached a
patch to demonstrate the idea.
The problem is, of course, generating the "CREATE OR REPLACE" statement.
There is some code to do this in pg_dump.c:dumpFunc(), but it's strongly
tied to pg_dump (global variables, output to Archive *, dependencies on
other functions, etc.).
I could either try to duplicate this code (and there's a lot of it), or
rip dumpFunc() and its dependencies out of pg_dump into dumpfunc.c and
make it callable both by pg_dump and psql. I've done some work towards
the latter, so I know it's possible, but it's a lot of work, which I
don't want to do if it won't be accepted anyway.
I would appreciate some advice on how to proceed.
-- ams
Attachment | Content-Type | Size |
---|---|---|
ef.diff | text/x-diff | 2.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | ITAGAKI Takahiro | 2008-06-16 02:11:40 | Re: pg_stat_statements |
Previous Message | Jeff Davis | 2008-06-16 01:07:37 | Re: planner document? |