Re: About functions

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Devrim GUNDUZ <devrim(at)oper(dot)metu(dot)edu(dot)tr>
Cc: PostgreSQL Mailing Lists-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: About functions
Date: 2002-02-25 07:59:00
Message-ID: 20020224235701.J72208-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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).

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darko Prenosil 2002-02-25 08:06:35 Re: template Database
Previous Message Michael Meskes 2002-02-25 07:47:25 Re: [HACKERS] connect with ecpg