plpgsql functions that want to do drops and
creates will need to use EXECUTE to run
statements for those tables.
On Thu, 11 Oct 2001, Gaurav Priyolkar wrote:
> Hi all,
>
> I have a function as follows:
>
> <code>
> [gaurav@linuxserver gaurav]$ cat foo
>
> DROP FUNCTION foo();
> CREATE FUNCTION foo() RETURNS INTEGER AS '
>
> BEGIN
>
> DROP TABLE foo_1;
> CREATE TABLE foo_1 AS SELECT x FROM foo;
>
> DROP TABLE foo_2;
> CREATE TABLE foo_2 AS SELECT x FROM foo_1;
>
> RETURN 1;
>
> END;
> ' LANGUAGE 'plpgsql';