Re: functions returning sets - Mailing list pgsql-hackers

From Tom Lane
Subject Re: functions returning sets
Date
Msg-id 20749.993846356@sss.pgh.pa.us
Whole thread Raw
In response to functions returning sets  (Alex Pilosov <alex@pilosoft.com>)
Responses Re: functions returning sets  (Alex Pilosov <alex@pilosoft.com>)
List pgsql-hackers
Alex Pilosov <alex@pilosoft.com> writes:
> Well, I'm on my way to implement what was discussed on list before.
> I am doing it the way Karel and Jan suggested: creating a
> pg_class/pg_attribute tuple[s] for a function that returns a setof. 

What?  You shouldn't need pg_class entries for functions unless they
return *tuples*.  setof has nothing to do with that.  Moreover, the
pg_class entry should be thought of as a record type independent of
the existence of any particular function returning it.

> I have a special RELKIND_FUNC for parser,

This seems totally wrong.

> Options are:
> 1) Create a special scan node type, T_FuncSeqScan and deal with it there.
> 2) Keep the T_SeqScan, explain to nodeSeqScan special logic when dealing
> with RELKIND_FUNC relations. 
> (I prefer this one, but I would like a validation of it)
> 3) explain to heap_getnext special logic. 

I prefer #1.  #2 or #3 will imply slowing down normal execution paths
with extra clutter to deal with functions.

BTW, based on Jan's sketch, I'd say it should be more like
T_CursorSeqScan where the object being scanned is a cursor/portal.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] rules on INSERT can't UPDATE new instance?
Next
From: Jan Wieck
Date:
Subject: Re: functions returning sets