Re: [WIP] UNNEST(REFCURSOR): allowing SELECT to consume data from a REFCURSOR - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: [WIP] UNNEST(REFCURSOR): allowing SELECT to consume data from a REFCURSOR
Date
Msg-id 3d4a579a-8385-41a8-9c5b-bb181a1b334c@manitou-mail.org
Whole thread Raw
In response to Re: [WIP] UNNEST(REFCURSOR): allowing SELECT to consume data from aREFCURSOR  (Dent John <denty@QQdd.eu>)
Responses Re: [WIP] UNNEST(REFCURSOR): allowing SELECT to consume data from aREFCURSOR  (Dent John <denty@QQdd.eu>)
List pgsql-hackers
    Dent John wrote:

> I’ve made a revision of this patch.

Some comments:

* the commitfest app did not extract up the patch from the mail,
possibly because it's buried in the MIME structure of the mail
(using plain text instead of HTML messages might help with that).
The patch has no status in http://commitfest.cputube.org/
probably because of this too.


* unnest-refcursor-v3.patch needs a slight rebase because this chunk
in the Makefile fails
-    regexp.o regproc.o ri_triggers.o rowtypes.o ruleutils.o \
+    refcursor.o regexp.o regproc.o ri_triggers.o rowtypes.o ruleutils.o \


* I'm under the impression that refcursor_unnest() is functionally
equivalent to a plpgsql implementation like this:

create function unnest(x refcursor) returns setof record as $$
declare
 r record;
begin
  loop
    fetch x into r;
    exit when not found;
    return next r;
  end loop;
end $$ language plpgsql;

but it would differ in performance, because internally a materialization step
could be avoided, but only when the other patch "Allow FunctionScans to
pipeline results"  gets in?
Or are performance benefits expected right away with this patch?

*
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -5941,7 +5941,7 @@ array_fill_internal(ArrayType *dims, ArrayType *lbs,


 /*
- * UNNEST
+ * UNNEST (array)
  */

This chunk looks unnecessary?

* some user-facing doc would be needed.

* Is it good to overload "unnest" rather than choosing a specific
function name?


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite



pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Add pg_file_sync() to adminpack
Next
From: Tom Lane
Date:
Subject: Re: Add pg_file_sync() to adminpack