Re: review: table function support

"Marko Kreen" <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.patches
Message-ID <[email protected]>
On 7/10/08, Pavel Stehule <[email protected]> wrote:
>  I am sending actualized patch
>
>  Regards
>  Pavel Stehule
>
>  2008/7/9 Pavel Stehule <[email protected]>:
>
> > 2008/7/9 Marko Kreen <[email protected]>:
>  >> Generally, the patch looks fine.  There are few issues still:
>  >>
>  >> - plpgsql: the result columns _do_ create local variables.
>  >>  AIUI, they should not?
>  >
>  > it was my mistake - it doesn't do local variables - fixed
>  >>
>  >> - pg_dump: is the psql_assert() introduction necessary, considering it
>  >>  is used only in one place?
>  >
>  > removed - argmode variables is checked before
>  >>
>  >> - There should be regression test for plpgsql too, that test if
>  >>  the behaviour is correct.
>  >>
>  >
>  > addeded
>  >> - The documentation should mention behaviour difference from OUT
>  >>  parameters.
>  >
>  > I will do it.
>  >>
>  >> Wishlist (probably out of scope for this patch):
>  >
>  > this is in my wishlist too, but postgresql doesn't support types like
>  > result of functions.
>  >>
>  >> - plpgsql: a way to create record variable for result row.  Something like:
>  >>
>  >>    CREATE FUNCTION foo(..) RETURNS TABLE (..) AS $$
>  >>    DECLARE
>  >>       retval   foo%ROWTYPE;
>  >>
>  >>
>  >>  Currently the OUT parameters are quite painful to use due to bad
>  >>  name resolving logic.  Such feature would be perfect replacement.
>  >>
>  >> --
>  >> marko
>  >>
>  > I'll send patch early, thank you much

Ok, last items:

- Attached is a patch that fixes couple C comments.

- I think plpgsql 38.1.2 chapter of "Supported Argument and Result Data
  Types" should also have a mention of TABLE functions.

Then I'm content with the patch.

-- 
marko


-- 
Sent via pgsql-patches mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches
tbl.comments.diff (text/x-patch, 1 KB)
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 3f90c93..6ae4521 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -6847,7 +6847,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
 
 	appendPQExpBuffer(q, "CREATE FUNCTION %s ", funcsig);
 
-	/* swich between RETURNS SETOF RECORD and RETURNS TABLE functions */
+	/* switch between RETURNS SETOF RECORD and RETURNS TABLE functions */
 	if (!is_returns_table_function(nallargs, argmodes))
 	{
 		rettypename = getFormattedTypeName(finfo->prorettype, zeroAsOpaque);
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index 612a84f..c683aea 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -402,7 +402,7 @@ do_compile(FunctionCallInfo fcinfo,
 				PLpgSQL_variable *argvariable;
 				int			argitemtype;
 
-				/* skip PROARGMODE_TABLE params - these params hasn't local variables */
+				/* PROARGMODE_TABLE params should not create local variables */
 				if (argmode == PROARGMODE_TABLE)
 					continue;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.