| From: | Scott Geller <sgellergsu(at)gmail(dot)com> |
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org |
| Subject: | plpgsql function question |
| Date: | 2010-04-04 05:19:58 |
| Message-ID: | h2ic598163c1004032219hbd347706o4e424bf515ce2e71@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
Hi
I am learning plpgsql and am getting errors on this simple function:
CREATE OR REPLACE FUNCTION test2(tab1 text, tab2 text )
RETURNS text AS
$$
BEGIN
EXECUTE 'create table ' || quote_ident(tab2) || ' as Select * from ' ||
quote_ident(tab1);
RETURN 'done';
END; $$
LANGUAGE 'plpgsql' VOLATILE;
Yet, when I replace tab1 & tab2 in the execute statement it works just fine:
CREATE OR REPLACE FUNCTION test2(tab1 text, tab2 text )
RETURNS text AS
$$
BEGIN
EXECUTE 'create table ' || quote_ident($2) || ' as Select * from ' ||
quote_ident($1);
RETURN 'done';
END; $$
LANGUAGE 'plpgsql' VOLATILE;
Any insight would be appreciated!
Thanks
Scott
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andreas Kretschmer | 2010-04-04 07:29:03 | Re: plpgsql function question |
| Previous Message | Matt Devlin | 2010-04-02 23:05:23 | postgres install question |