Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I edit a function in PSQL

I created a default function in PGADMIN but the server doesn't have that software.

How can I edit the function using PSQL?

The closest I've seen is

\df+ function_name

but the output is garbled and not editable.


This will open the function using a default editor.

\ef function_name()

But then when I save it, it saves as this...

"/tmp/psql.edit.20631.sql" in the bin folder,

which doesn't seem correct.

like image 388
some1 Avatar asked May 21 '16 23:05

some1


1 Answers

After you edit the function with \ef, you need to enter \g or ; to execute the statement that updates the function.

So it would be

\ef function_name()
[edit away]
\g
like image 139
Peter Eisentraut Avatar answered Oct 02 '22 16:10

Peter Eisentraut