Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2c863ca

Browse files
committed
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
1 parent2cdcf45 commit2c863ca

File tree

7 files changed

+407
-59
lines changed

7 files changed

+407
-59
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.443 2008/07/21 04:47:00 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.444 2008/09/06 00:01:21 tgl Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -11562,6 +11562,10 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1156211562
<primary>pg_get_ruledef</primary>
1156311563
</indexterm>
1156411564

11565+
<indexterm>
11566+
<primary>pg_get_functiondef</primary>
11567+
</indexterm>
11568+
1156511569
<indexterm>
1156611570
<primary>pg_get_function_arguments</primary>
1156711571
</indexterm>
@@ -11643,6 +11647,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1164311647
<entry>decompile internal form of an expression, assuming that any Vars
1164411648
in it refer to the relation indicated by the second parameter</entry>
1164511649
</row>
11650+
<row>
11651+
<entry><literal><function>pg_get_functiondef</function>(<parameter>func_oid</parameter>)</literal></entry>
11652+
<entry><type>text</type></entry>
11653+
<entry>get definition of a function</entry>
11654+
</row>
1164611655
<row>
1164711656
<entry><literal><function>pg_get_function_arguments</function>(<parameter>func_oid</parameter>)</literal></entry>
1164811657
<entry><type>text</type></entry>
@@ -11756,6 +11765,8 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1175611765
</para>
1175711766

1175811767
<para>
11768+
<function>pg_get_functiondef</> returns a complete
11769+
<command>CREATE OR REPLACE FUNCTION</> statement for a function.
1175911770
<function>pg_get_function_arguments</function> returns the argument list
1176011771
of a function, in the form it would need to appear in within
1176111772
<command>CREATE FUNCTION</>.

‎doc/src/sgml/ref/psql-ref.sgml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.209 2008/07/03 03:37:16 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.210 2008/09/06 00:01:21 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -1195,6 +1195,29 @@ testdb=&gt;
11951195
</varlistentry>
11961196

11971197

1198+
<varlistentry>
1199+
<term><literal>\ef <replaceable class="parameter">function_description</replaceable> </literal></term>
1200+
1201+
<listitem>
1202+
<para>
1203+
This command fetches and edits the definition of the named function,
1204+
in the form of a <command>CREATE OR REPLACE FUNCTION</> command.
1205+
Editing is done in the same way as for <literal>\e</>.
1206+
After the editor exits, the updated command waits in the query buffer;
1207+
type semicolon or <literal>\g</> to send it, or <literal>\r</>
1208+
to cancel.
1209+
</para>
1210+
1211+
<para>
1212+
The target function can be specified by name alone, or by name
1213+
and arguments, for example <literal>foo(integer, text)</>.
1214+
The argument types must be given if there is more
1215+
than one function of the same name.
1216+
</para>
1217+
</listitem>
1218+
</varlistentry>
1219+
1220+
11981221
<varlistentry>
11991222
<term><literal>\echo <replaceable class="parameter">text</replaceable> [ ... ]</literal></term>
12001223
<listitem>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp