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

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Minor systax error but not able to resolve it...
Дата
Msg-id 4B843B9F.2050905@archonet.com
обсуждение исходный текст
Ответ на Re: Minor systax error but not able to resolve it...  (dipti shah <shahdipti1980@gmail.com>)
Ответы Re: Minor systax error but not able to resolve it...  (dipti shah <shahdipti1980@gmail.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: adam_pgsql
Дата:
Сообщение: Re: "make check" failed on 8.4.2 install
Следующее
От: Radcon Entec
Дата:
Сообщение: Npgsql connection string editor?