Re: Am I entering a world of pain... - Mailing list pgsql-novice

From Tom Lane
Subject Re: Am I entering a world of pain...
Date
Msg-id 17726.1060729255@sss.pgh.pa.us
Whole thread Raw
In response to Am I entering a world of pain...  (Aled Morris <aled@tesco.net>)
List pgsql-novice
Aled Morris <aled@tesco.net> writes:
> create or replace function droptable (varchar(255)) returns void as '
> begin
>   drop table $1;
>   return;
> end;
> ' language 'plpgsql';

Try
    execute ''drop table '' || $1;
instead.  See the plpgsql manual's overview for an explanation why you
can't use variables as table/field names except through EXECUTE.

            regards, tom lane

pgsql-novice by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Am I entering a world of pain...
Next
From: glenn
Date:
Subject: VI key strokes