Hi, could anyone please help me to sort out below error. I have spent lot of
time but couldn't resolved it.
mydb=> CREATE OR REPLACE FUNCTION test_create()
RETURNS void AS
$BODY$
$cmd = "CREATE TABLE test-table(col varchar not null);";
spi_exec_query("CREATE OR REPLACE FUNCTION my_tmp_func() RET
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_f
Richard Huxton writes:
> 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
> t
Thanks. Putting $cmd in single quote resolve the error but it generated
other error. :(
mydb=> CREATE OR REPLACE FUNCTION test_create()
RETURNS void AS
$BODY$
$cmd = "CREATE TABLE testtable(col varchar not null);";
spi_exec_query("CREATE OR REPLACE FUNCTION myfunc() RETURNS void AS
'$cmd'LANGUAG
On 23/02/10 17:15, dipti shah wrote:
Thanks. Putting $cmd in single quote resolve the error but it generated
other error. :(
mydb=> CREATE OR REPLACE FUNCTION test_create()
RETURNS void AS
$BODY$
$cmd = "CREATE TABLE testtable(col varchar not null);";
spi_exec_query("CREATE OR REPLACE FUNCTI
Wonderful! Thanks.
On Wed, Feb 24, 2010 at 2:03 AM, Richard Huxton wrote:
> On 23/02/10 17:15, dipti shah wrote:
>
>> Thanks. Putting $cmd in single quote resolve the error but it generated
>> other error. :(
>>
>> mydb=> CREATE OR REPLACE FUNCTION test_create()
>> RETURNS void AS
>> $BODY$
>