Обсуждение: Re: [HACKERS] check_srf_call_placement() isn't always setting p_hasTargetSRFs

Поиск
Список
Период
Сортировка

Re: [HACKERS] check_srf_call_placement() isn't always setting p_hasTargetSRFs

От
Tom Lane
Дата:
Andres Freund <andres@anarazel.de> writes:
> Is there a reason not to just set p_hasTargetSRFs once towards the end
> of the function, instead of doing so for all the non-error cases?

Yes: it's not supposed to get set when the SRF is in FROM.

> I wonder if there should be a seperate expression type for
> the INSERT ... VALUES(exactly-one-row); since that behaves quite
> differently.

Perhaps.  Or maybe we should just use EXPR_KIND_SELECT_TARGET for that?
        regards, tom lane



Re: [HACKERS] check_srf_call_placement() isn't always setting p_hasTargetSRFs

От
Tom Lane
Дата:
I wrote:
> Andres Freund <andres@anarazel.de> writes:
>> I wonder if there should be a seperate expression type for
>> the INSERT ... VALUES(exactly-one-row); since that behaves quite
>> differently.

> Perhaps.  Or maybe we should just use EXPR_KIND_SELECT_TARGET for that?

After looking around, I think we probably better use a different
EXPR_KIND; even if all the functionality is identical, we don't want
ParseExprKindName() to say "SELECT" when we're throwing an error for
INSERT...VALUES.

Also, I noticed that we don't actually allow SRFs in VALUES RTEs:

regression=# select * from (values(1,generate_series(11,13)),(2,0)) v;
ERROR:  set-valued function called in context that cannot accept a set

That's because ValuesNext doesn't handle it.  I'm not particularly
excited about fixing that, given that it's always been that way and
no one has complained yet.  But check_srf_call_placement() is misinformed,
since it thinks the case works.

Will go fix these things.
        regards, tom lane



Re: [HACKERS] check_srf_call_placement() isn't always settingp_hasTargetSRFs

От
Andres Freund
Дата:
On 2017-01-16 14:34:58 -0500, Tom Lane wrote:
> Will go fix these things.

Thanks!

Andres