From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | dipti shah <shahdipti1980(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org, pgsql-novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Minor systax error but not able to resolve it... |
Date: | 2010-02-23 11:55:15 |
Message-ID: | 4B83C223.30909@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice |
On 23/02/10 11:25, dipti shah wrote:
> Hi, could anyone please help me to sort out below error. I have spent lot of
> time but couldn't resolved it.
> ERROR: error from Perl function "test_create": syntax error at or near
> "CREATE" at line 3.
> spi_exec_query("CREATE OR REPLACE FUNCTION my_tmp_func() RETURNS void AS
> $cmd LANGUAGE sql;");
You're interpolating $cmd here but not quoting it, so you end up with:
... RETURNS void AS CREATE TABLE test-table...
whereas you want:
... RETURNS void AS 'CREATE TABLE test-table...'...
Probably best to use dollar-quoting: $TMP$ or similar, but don't forget
to escapt the $ or perl will think it's a variable.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2010-02-23 12:10:42 | Re: Subqueries or Joins? Problems with multiple table query |
Previous Message | Thom Brown | 2010-02-23 11:54:10 | Re: Subqueries or Joins? Problems with multiple table query |
From | Date | Subject | |
---|---|---|---|
Next Message | Susan M Farley | 2010-02-23 14:58:45 | Function Error |
Previous Message | dipti shah | 2010-02-23 11:25:52 | Minor systax error but not able to resolve it... |