error while generating and EXECUTEing a query dynamically - Mailing list pgsql-general

From Gaurav Priyolkar
Subject error while generating and EXECUTEing a query dynamically
Date
Msg-id 20010912234516.C918@goatelecom.com
Whole thread Raw
Responses Re: error while generating and EXECUTEing a query dynamically
Re: error while generating and EXECUTEing a query dynamically
List pgsql-general
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


pgsql-general by date:

Previous
From: Justin Clift
Date:
Subject: Submissions for PostgreSQL Consulting Companies ?
Next
From: Barry Lind
Date:
Subject: Re: Fwd: Re: unicode in 7.1