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

Commite3e3d2a

Browse files
committed
Extend ExecMakeFunctionResult() to support set-returning functions that return
via a tuplestore instead of value-per-call. Refactor a few things to reduceensuing code duplication with nodeFunctionscan.c. This represents thereasonably noncontroversial part of my proposed patch to switch SQL functionsover to returning tuplestores. For the moment, SQL functions still do thingsthe old way. However, this change enables PL SRFs to be called in targetlists(observe changes in plperl regression results).
1 parenta80a122 commite3e3d2a

File tree

10 files changed

+440
-165
lines changed

10 files changed

+440
-165
lines changed

‎contrib/tablefunc/tablefunc.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.c,v 1.53 2008/05/17 01:28:22 adunstan Exp $
2+
* $PostgreSQL: pgsql/contrib/tablefunc/tablefunc.c,v 1.54 2008/10/28 22:02:05 tgl Exp $
33
*
44
*
55
* tablefunc
@@ -709,7 +709,8 @@ crosstab_hash(PG_FUNCTION_ARGS)
709709
ereport(ERROR,
710710
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
711711
errmsg("set-valued function called in context that cannot accept a set")));
712-
if (!(rsinfo->allowedModes&SFRM_Materialize))
712+
if (!(rsinfo->allowedModes&SFRM_Materialize)||
713+
rsinfo->expectedDesc==NULL)
713714
ereport(ERROR,
714715
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
715716
errmsg("materialize mode required, but it is not " \
@@ -1072,7 +1073,8 @@ connectby_text(PG_FUNCTION_ARGS)
10721073
ereport(ERROR,
10731074
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
10741075
errmsg("set-valued function called in context that cannot accept a set")));
1075-
if (!(rsinfo->allowedModes&SFRM_Materialize))
1076+
if (!(rsinfo->allowedModes&SFRM_Materialize)||
1077+
rsinfo->expectedDesc==NULL)
10761078
ereport(ERROR,
10771079
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
10781080
errmsg("materialize mode required, but it is not " \
@@ -1139,7 +1141,6 @@ connectby_text_serial(PG_FUNCTION_ARGS)
11391141
char*branch_delim=NULL;
11401142
boolshow_branch= false;
11411143
boolshow_serial= true;
1142-
11431144
ReturnSetInfo*rsinfo= (ReturnSetInfo*)fcinfo->resultinfo;
11441145
TupleDesctupdesc;
11451146
AttInMetadata*attinmeta;
@@ -1151,7 +1152,8 @@ connectby_text_serial(PG_FUNCTION_ARGS)
11511152
ereport(ERROR,
11521153
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
11531154
errmsg("set-valued function called in context that cannot accept a set")));
1154-
if (!(rsinfo->allowedModes&SFRM_Materialize))
1155+
if (!(rsinfo->allowedModes&SFRM_Materialize)||
1156+
rsinfo->expectedDesc==NULL)
11551157
ereport(ERROR,
11561158
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
11571159
errmsg("materialize mode required, but it is not " \

‎doc/src/sgml/plpgsql.sgml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.134 2008/09/24 19:51:22 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.135 2008/10/28 22:02:05 tgl Exp $ -->
22

33
<chapter id="plpgsql">
44
<title><application>PL/pgSQL</application> - <acronym>SQL</acronym> Procedural Language</title>
@@ -1575,10 +1575,6 @@ LANGUAGE 'plpgsql' ;
15751575

15761576
SELECT * FROM getallfoo();
15771577
</programlisting>
1578-
1579-
Note that functions using <command>RETURN NEXT</command> or
1580-
<command>RETURN QUERY</command> must be called as a table source in
1581-
a <literal>FROM</literal> clause.
15821578
</para>
15831579

15841580
<note>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp