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

Commitb4d7ea5

Browse files
committed
Add table creation and population to example
from John Gage
1 parentd017f83 commitb4d7ea5

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

‎doc/src/sgml/xfunc.sgml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.150 2010/07/25 08:30:42 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/xfunc.sgml,v 1.151 2010/07/26 20:14:05 petere Exp $ -->
22

33
<sect1 id="xfunc">
44
<title>User-Defined Functions</title>
@@ -861,10 +861,23 @@ SELECT * FROM getfoo(1) AS t1;
861861
output parameters, like this:
862862

863863
<programlisting>
864+
CREATE TABLE tab (y int, z int);
865+
INSERT INTO tab VALUES (1, 2), (3, 4), (5, 6), (7, 8);
866+
864867
CREATE FUNCTION sum_n_product_with_tab (x int, OUT sum int, OUT product int)
865-
RETURNS SETOF record AS $$
868+
RETURNS SETOF record
869+
AS $$
866870
SELECT $1 + tab.y, $1 * tab.y FROM tab;
867871
$$ LANGUAGE SQL;
872+
873+
SELECT * FROM sum_n_product_with_tab(10);
874+
sum | product
875+
-----+---------
876+
11 | 10
877+
13 | 30
878+
15 | 50
879+
17 | 70
880+
(4 rows)
868881
</programlisting>
869882

870883
The key point here is that you must write <literal>RETURNS SETOF record</>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp