Re: About functions - Mailing list pgsql-general

From Gregory Wood
Subject Re: About functions
Date
Msg-id 036e01c1be05$1e605c30$7889ffcc@comstock.com
Whole thread Raw
In response to Re: About functions  (Devrim GUNDUZ <devrim@oper.metu.edu.tr>)
Responses Re: About functions  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
> > 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 ||.

Greg


pgsql-general by date:

Previous
From: "Nikola Milutinovic"
Date:
Subject: A minor bug and a complaint
Next
From: "Robert Treat"
Date:
Subject: Re: tcpip_socket vs -i