Re: error while generating and EXECUTEing a query dynamically

From: "Jeff Eckermann" <jeckermann(at)verio(dot)net>
To: "Gaurav Priyolkar" <gaurav_lists(at)yahoo(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: error while generating and EXECUTEing a query dynamically
Date: 2001-09-14 21:37:04
Message-ID: 02fd01c13d65$6601a6a0$279c10ac@INTERNAL
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Your function worked fine for me (I copied and pasted).
What PostgeSQL version are you running? EXECUTE is a new feature for
version 7.1.

----- Original Message -----
From: "Gaurav Priyolkar" <gaurav_lists(at)yahoo(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, September 12, 2001 1:15 PM
Subject: [GENERAL] error while generating and EXECUTEing a query dynamically

> Hi all,
>
> The machine I am sending this mail from does not have postgres, but I
> did this just this morning so am typing from memory:
>
> <code>
>
> CREATE FUNCTION footable() RETURNS INTEGER AS '
>
> DECLARE
> sql VARCHAR(1000);
>
> BEGIN
>
> sql := ''CREATE TABLE foo (x INT, y CHAR) '';
>
> EXECUTE sql;
>
> RETURN 1;
>
> END;
> ' LANGUAGE 'plpgsql';
>
>
> <code>
>
>
> Now when I try to execute this function I get an error message saying
>
> <error>
> parse error at or near ""
> <error>
>
>
> I will get the exact function and error output from other machine
> tomorrow (the actual query I am generating is more complex) but in the
> meantime if anyone can help with this example, I would be most
> grateful. Where am I going wrong?
>
> TIA
>
> Gaurav
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Eckermann 2001-09-14 21:41:53 Re: need help
Previous Message Jason Earl 2001-09-14 21:36:09 Re: get certain # of recs