mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Implement a psql command "\ef" to edit the definition of a function.
In support of that, create a backend function pg_get_functiondef(). The psql command is functional but maybe a bit rough around the edges... Abhijit Menon-Sen
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.443 2008/07/21 04:47:00 tgl Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.444 2008/09/06 00:01:21 tgl Exp $ -->
|
||||
|
||||
<chapter id="functions">
|
||||
<title>Functions and Operators</title>
|
||||
@ -11562,6 +11562,10 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
|
||||
<primary>pg_get_ruledef</primary>
|
||||
</indexterm>
|
||||
|
||||
<indexterm>
|
||||
<primary>pg_get_functiondef</primary>
|
||||
</indexterm>
|
||||
|
||||
<indexterm>
|
||||
<primary>pg_get_function_arguments</primary>
|
||||
</indexterm>
|
||||
@ -11643,6 +11647,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
|
||||
<entry>decompile internal form of an expression, assuming that any Vars
|
||||
in it refer to the relation indicated by the second parameter</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal><function>pg_get_functiondef</function>(<parameter>func_oid</parameter>)</literal></entry>
|
||||
<entry><type>text</type></entry>
|
||||
<entry>get definition of a function</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal><function>pg_get_function_arguments</function>(<parameter>func_oid</parameter>)</literal></entry>
|
||||
<entry><type>text</type></entry>
|
||||
@ -11756,6 +11765,8 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<function>pg_get_functiondef</> returns a complete
|
||||
<command>CREATE OR REPLACE FUNCTION</> statement for a function.
|
||||
<function>pg_get_function_arguments</function> returns the argument list
|
||||
of a function, in the form it would need to appear in within
|
||||
<command>CREATE FUNCTION</>.
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.209 2008/07/03 03:37:16 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.210 2008/09/06 00:01:21 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -1195,6 +1195,29 @@ testdb=>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>\ef <replaceable class="parameter">function_description</replaceable> </literal></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
This command fetches and edits the definition of the named function,
|
||||
in the form of a <command>CREATE OR REPLACE FUNCTION</> command.
|
||||
Editing is done in the same way as for <literal>\e</>.
|
||||
After the editor exits, the updated command waits in the query buffer;
|
||||
type semicolon or <literal>\g</> to send it, or <literal>\r</>
|
||||
to cancel.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The target function can be specified by name alone, or by name
|
||||
and arguments, for example <literal>foo(integer, text)</>.
|
||||
The argument types must be given if there is more
|
||||
than one function of the same name.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>\echo <replaceable class="parameter">text</replaceable> [ ... ]</literal></term>
|
||||
<listitem>
|
||||
|
Reference in New Issue
Block a user