Skip site navigation (1) Skip section navigation (2)

Re: Minor systax error but not able to resolve it...

From: dipti shah <shahdipti1980(at)gmail(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-24 05:38:07
Message-ID: d5b05a951002232138l689ff213wb53401b9df5030a8@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novice
Wonderful! Thanks.

On Wed, Feb 24, 2010 at 2:03 AM, Richard Huxton <dev(at)archonet(dot)com> 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$
>> $cmd = "CREATE TABLE testtable(col varchar not null);";
>> spi_exec_query("CREATE OR REPLACE FUNCTION myfunc() RETURNS void AS
>> '$cmd'LANGUAGE plperl;");
>> spi_exec_query("SELECT myfunc();");
>> $BODY$
>>   LANGUAGE 'plperl';
>> CREATE FUNCTION
>> mydb=>  SELECT test_create();
>> ERROR:  error from Perl function "test_create": error from Perl function
>> "myfunc": Can't locate object method "col" via package "varchar" (perhaps
>> you forgot to load "varchar"?) at line 1. at line 3.
>>
>
> The function "myfunc" you are trying to create as plperl isn't perl. Either
> give it some perl or try "LANGUAGE SQL".
>
> --
>  Richard Huxton
>  Archonet Ltd
>

In response to

pgsql-novice by date

Next:From: dipti shahDate: 2010-02-24 05:47:49
Subject: Re: SET Role doesn't work from Security Definer Function...
Previous:From: Greg CocksDate: 2010-02-23 23:00:01
Subject: Seeking experiences 'accessing' Microsoft Active Directory credentials from PostgreSQL, in conjunction with the sys admin / IT...

pgsql-general by date

Next:From: dipti shahDate: 2010-02-24 05:47:49
Subject: Re: SET Role doesn't work from Security Definer Function...
Previous:From: LewDate: 2010-02-24 05:37:05
Subject: Re: typecaste object to array

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group