Re: R: Re: R: Re: Weird EXECUTE ... USING behaviour

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
Cc: adrian(dot)klaver(at)gmail(dot)com, Scott Mead <scott(dot)lists(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: R: Re: R: Re: Weird EXECUTE ... USING behaviour
Date: 2010-01-14 15:03:21
Message-ID: 162867791001140703y75b2c35era8efd1d63bee1949@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/1/14 Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>:
> 2010/1/14 Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>:
>> On Wednesday 13 January 2010 10:19:57 pm Vincenzo Romano wrote:
>>
>>> >
>>> > Scott, thanks for that I must have read through that section several
>>> > times at least with out picking up on it.
>>> >
>>> > --
>>> > Adrian Klaver
>>> > adrian(dot)klaver(at)gmail(dot)com
>>>
>>> Really?
>>>
>>> That section is not in any page of the v8.4.2 documentation either PDF or
>>> HTML. The sentence has been introduced (yesterday?) in 8.5devel, which is
>>> far from being "current".
>>
>> http://www.postgresql.org/docs/8.4/interactive/plpgsql-implementation.html
>> 38.10.1. Variable Substitution
>> Last paragraph.
>>
>>>
>>>     I only hope they won't change the manual to match the feature/bug
>>> (warning: new joke)
>>>
>>> So that was not a joke at all! :-(
>>
>>
>>
>> --
>> Adrian Klaver
>> adrian(dot)klaver(at)gmail(dot)com
>>
>
> Now I'm pretty surfe it's a bug.
>
>
> CREATE OR REPLACE FUNCTION f()
> RETURNS VOID
> LANGUAGE plpgsql
> AS $function$
> DECLARE
>  cmd TEXT;
> BEGIN
>  EXECUTE '
>    SELECT $l0$ALTER TABLE test ALTER COLUMN i SET DEFAULT $1 $l0$
>  ' INTO cmd USING 42;
>  RAISE INFO '%',cmd;
> END;
> $function$
>
> SELECT f();
> INFO:  ALTER TABLE test ALTER COLUMN i SET DEFAULT $1
>
> The command to be executed is DML (SELECT). The substitution doesn't take place.

yes. You cannot call SELECT 'ALTER ...'

Regards
Pavel Stehule

>
> --
> Vincenzo Romano
> NotOrAnd Information Technologies
> cel. +39 339 8083886  | gtalk. vincenzo(dot)romano(at)notorand(dot)it
> fix. +39 0823 454163  | skype. notorand.it
> fax. +39 02 700506964 | msn.   notorand.it
> NON QVIETIS MARIBVS NAVTA PERITVS
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vincenzo Romano 2010-01-14 15:10:59 Re: R: Re: R: Re: Weird EXECUTE ... USING behaviour
Previous Message Andy Colson 2010-01-14 15:02:12 Re: Configuration Optimisation