From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PL/pgSQL EXECUTE '..' USING with unknown |
Date: | 2010-08-06 07:36:44 |
Message-ID: | 4C5BBB8C.7080006@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 06/08/10 01:13, Tom Lane wrote:
> Andrew Dunstan<andrew(at)dunslane(dot)net> writes:
>> On 08/05/2010 05:11 PM, Tom Lane wrote:
>>> This example doesn't seem terribly compelling. Why would you bother
>>> using USING with constants?
>
>> In a more complex example you might use $1 in more than one place in the
>> query.
>
> Well, that's better than no justification, but it's still pretty weak.
> A bigger problem is that doing anything like this will require reversing
> the logical path of causation in EXECUTE USING. Right now, we evaluate
> the USING expressions first, and then their types feed forward into
> parsing the EXECUTE string. What Heikki is suggesting requires
> reversing that, at least to some extent. I'm not convinced it's
> possible without breaking other cases that are more important.
One approach is to handle the conversion from unknown to the right data
type transparently in the backend. Attached patch adds a
coerce-param-hook for fixed params that returns a CoerceViaIO node to
convert the param to the right type at runtime. That's quite similar to
the way unknown constants are handled.
The patch doesn't currently check that a parameter is only resolved to
one type in the same query, but that can be added.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
fixed-params-unknown-coerce-hook-1.patch | text/x-diff | 2.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2010-08-06 07:40:22 | Re: PL/pgSQL EXECUTE '..' USING with unknown |
Previous Message | Heikki Linnakangas | 2010-08-06 07:28:29 | Re: MERGE Specification |