Re: Fixing bug #8228 ("set-valued function called in context that cannot accept a set")

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fixing bug #8228 ("set-valued function called in context that cannot accept a set")
Date: 2014-01-07 03:42:28
Message-ID: 1389066148426-5785636.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane-2 wrote
> David Johnston &lt;

> polobo@

> &gt; writes:
>> The whole "varchar/varchar(30)" discrepancy is bothersome and since the
>> example forces a function-call via the use of "lower(...)", and doesn't
>> test
>> the non-function situation, I am concerned this patch is incorrect.
>
> The reason casting to varchar(30) fails is that that results in invocation
> of a function (to enforce the length limit). Casting to varchar is just a
> RelabelType operation, which doesn't have two different code paths for
> set and not-set inputs.
>
> I did check the patch against your original example, but I thought using
> lower() made the purpose of the regression test case more apparent.

Yeah, I caught that part. My focus was on the non-function version.

Not being able to apply the patch and test myself it sounds like you likely
made the function-invocation version succeed along with the original
re-label-only version.

I guess backward-compatibility concerns forces this solution but after
thinking through what was happening I was leaning more toward making both
queries fail. An SRF in a CASE expression seems like a foot-gun to me. SRF
in the select-list is someone of a foot-gun too but understandable given the
recency of the addition of LATERAL to our toolbox.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Fixing-bug-8228-set-valued-function-called-in-context-that-cannot-accept-a-set-tp5785622p5785636.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-01-07 04:07:32 Re: [COMMITTERS] pgsql: Upgrade to Autoconf 2.69
Previous Message Tom Lane 2014-01-07 03:23:16 Re: Re: Fixing bug #8228 ("set-valued function called in context that cannot accept a set")