From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Petr Jelinek <pjmodos(at)pjmodos(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Proposal: USING clause for DO statement |
Date: | 2009-11-21 18:56:02 |
Message-ID: | 162867790911211056j49485332r25a9b41b444ae464@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2009/11/21 Merlin Moncure <mmoncure(at)gmail(dot)com>:
> On Sat, Nov 21, 2009 at 1:24 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> 2009/11/21 Merlin Moncure <mmoncure(at)gmail(dot)com>:
>>> On Sat, Nov 21, 2009 at 12:36 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>>>> Perhaps part of the problem is that psql can't interpolate its variable
>>>>> into strings. Solving that might lessen the impetus for this, and have other
>>>>> uses besides.
>> I am not sure, if I understand well. Can you show some use cases, please?
>
> If I understand Andrew correctly,
>
> \set msg world
>
> DO $$
> BEGIN
> RAISE NOTICE 'Hello, %', :msg;
> END
> $$;
>
This is base of my proposal :). But we cannot do it directly:
a) the body of DO statement is black box for psql parser,
b) psql does know nothing about used PL language - without this
knowledge cannot do correct substitution: plpgsq use ', java use "",
perl use ""
these points are reason, why I propose "external USING clause" - it
outside blackbox, it is common for all PL
Point b is solved via using a real params - not substitution.
Regards
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Smith | 2009-11-21 19:32:49 | Re: Hot standby and removing VACUUM FULL |
Previous Message | Merlin Moncure | 2009-11-21 18:35:19 | Re: Proposal: USING clause for DO statement |