Re: functions returning sets

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Rogers <jrogers(at)findlaw(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: functions returning sets
Date: 2003-12-16 18:44:49
Message-ID: 3FDF52A1.9040803@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Jeff Rogers <jrogers(at)findlaw(dot)com> writes:
>>I expect this latter to return all the ids, but it seems to only return every
>>other one.
>
> Hmm, this looks like a bug having to do with not resetting state
> correctly for the next invocation of the SRF. Hard to tell whether
> the bug is in your code or the system's support for SRFs though.
>
> Joe, did you see
> http://archives.postgresql.org/pgsql-general/2003-12/msg00709.php
> ? I don't have time to look at this right now ...

I've not gotten to the bottom of this, but I can confirm the issue.

The way I would expect this query to be written does work:

regression=# select id from foo where 'a' in (select * from
pgxml_xpath(doc,'/top/node'));
id
----
1
2
3
(3 rows)

So the problem seems to be related specifically to "SRF returning setof
scalar in targetlist of subselect". Maybe some difference between
ExecMakeFunctionResult and ExecMakeTableFunctionResult? SRFs returning
complex types are not allowed in targetlists, but in this case there is
no restriction because the return type is scalar.

I'll keep digging as time allows.

Joe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Bartlett 2003-12-16 18:57:09 Re: Reload bytea [was Re: Picture with Postgres and Delphi]
Previous Message Joe Conway 2003-12-16 18:31:16 Re: DB with bytea types reload problem