Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/1/14 Pavel Stehule <pavel.stehule@xxxxxxxxx>:
> 2010/1/14 Vincenzo Romano <vincenzo.romano@xxxxxxxxxxx>:
>> 2010/1/14 Adrian Klaver <adrian.klaver@xxxxxxxxx>:
>>> On Wednesday 13 January 2010 10:19:57 pm Vincenzo Romano wrote:
...
>> 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 ...'

SELECT 'ALTER ...' is to select a text string into a variable!
You mean the parse will give a look into my constant string to see
whether I'm trying to build a dynamic DDL command?
This would be awesome!

-- 
Vincenzo Romano
NotOrAnd Information Technologies
NON QVIETIS MARIBVS NAVTA PERITVS

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux