using vars in ddl in procedure call

Поиск
Список
Период
Сортировка
От Gauthier, Dave
Тема using vars in ddl in procedure call
Дата
Msg-id 0AD01C53605506449BA127FB8B99E5E11802F759@FMSMSX105.amr.corp.intel.com
обсуждение исходный текст
Ответы Re: using vars in ddl in procedure call  (salah jubeh <s_jubeh@yahoo.com>)
Re: using vars in ddl in procedure call  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general

Hi:

 

v9.0.1 on linux.

 

Trying (failing) a test to see if I can run ddl in a procedure where elements of the ddl are vars.  Consider...

 

create or replace function newcol (text) returns integer as $$

declare

  newcol alias for $1;

begin

 

  alter table target add column newcol text;

 

return(0);

 

end;

$$ language plpgsql;

 

This successfully adds a column called "newcol" instead of what I passed it as an arg.

 

Any suggestions on how to make this work?

 

Thanks !

 

В списке pgsql-general по дате отправления:

Предыдущее
От: Chris Angelico
Дата:
Сообщение: Re: Understanding autocommit
Следующее
От: Nicola Cisternino
Дата:
Сообщение: String comparision in PostgreSQL