Re: About functions - Mailing list pgsql-general

From Stephan Szabo
Subject Re: About functions
Date
Msg-id 20020225070417.M75113-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: About functions  ("Gregory Wood" <gregw@com-stock.com>)
List pgsql-general
On Mon, 25 Feb 2002, Gregory Wood wrote:

> > > You can't use the argument as a parameter directly in that sql
> statement.
> > > You might be able to do:
> > > EXECUTE ''DROP FUNCTION '' || $1;
> >
> > Thanks but, again an error:
> >
> > test=# CREATE FUNCTION dropfunc(text) RETURNS integer AS '
> > test'#         BEGIN;
> > test'#                 EXECUTE ''DROP FUNCTION'' $1;
> > test'#                 SELECT 1;
> > test'#         END;
> > test'# '
> > test-# LANGUAGE SQL;
> > ERROR:  parser: parse error at or near "EXECUTE"
> > test=#
> >
> > Let me dive into my manuals :)
>
> I'm pretty sure EXECUTE is only available in the PL/pgSQL language, and not
> the SQL language. Also, you need to append the parameter to the rest of the
> drop function string, so be sure to include a space after FUNCTION and
> concat the two together with ||.

And, I think the begin/end are illegal in sql language functions
(since the last statement isn't a select) and there shouldn't be a
semicolon after begin for plpgsql.


pgsql-general by date:

Previous
From: tony
Date:
Subject: some pgaccess questions
Next
From: Doug McNaught
Date:
Subject: Re: Work Around For Oracle Feature