Re: About functions

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: About functions
Дата
Msg-id 20020224235701.J72208-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на About functions  (Devrim GUNDUZ <devrim@oper.metu.edu.tr>)
Ответы Re: About functions
Список pgsql-general
On Sun, 24 Feb 2002, Devrim GUNDUZ wrote:

>
> Hi,
>
> While working on functions, I had a problem:
>
> I wanted to write a function whict would drop my function. It is simply as
> below:
>
>
>     CREATE FUNCTION dropfunc(text) RETURNS integer AS '
>             DROP FUNCTION $1 ;
>             SELECT 1;
>     '
>     LANGUAGE SQL;
>
>
> But PostgreSQL answers:
>
> test=# ERROR:  parser: parse error at or near "$1"
>
>
> What is the error in here?

You can't use the argument as a parameter directly in that sql statement.
You might be able to do:
EXECUTE ''DROP FUNCTION '' || $1;

(Note also that the above requires arguments of the form
foo(int) not just foo).



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

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: [HACKERS] connect with ecpg
Следующее
От: Devrim GUNDUZ
Дата:
Сообщение: Re: About functions