psql: \edit-function
| От | Abhijit Menon-Sen |
|---|---|
| Тема | psql: \edit-function |
| Дата | |
| Msg-id | 20080616020121.GA18941@toroid.org обсуждение исходный текст |
| Ответы |
Re: psql: \edit-function |
| Список | 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
Вложения
В списке pgsql-hackers по дате отправления: