From baaab149b10a2dd47fa3c4c5544468b10a3d87ec Mon Sep 17 00:00:00 2001 From: Mitsuru Hinata Date: Thu, 18 Jul 2024 15:12:37 +0900 Subject: [PATCH] fix "SQL Functions Returning Sets" docs in xfunc.sgml --- doc/src/sgml/xfunc.sgml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 7e92e89846..3adbc7a19d 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -1056,22 +1056,22 @@ SELECT * FROM getfoo(1) AS t1; output parameters, like this: -CREATE TABLE tab (y int, z int); -INSERT INTO tab VALUES (1, 2), (3, 4), (5, 6), (7, 8); +CREATE TABLE tab (x int, y int, z int); +INSERT INTO tab VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12); -CREATE FUNCTION sum_n_product_with_tab (x int, OUT sum int, OUT product int) +CREATE FUNCTION sum_n_product_with_tab (int, OUT sum int, OUT product int) RETURNS SETOF record AS $$ - SELECT $1 + tab.y, $1 * tab.y FROM tab; + SELECT $1 + tab.x, $1 * tab.x FROM tab; $$ LANGUAGE SQL; SELECT * FROM sum_n_product_with_tab(10); sum | product -----+--------- 11 | 10 - 13 | 30 - 15 | 50 + 14 | 40 17 | 70 + 20 | 100 (4 rows) -- 2.43.5