Re: Error in PlPython procedure

Поиск
Список
Период
Сортировка
От brian
Тема Re: Error in PlPython procedure
Дата
Msg-id 47BCC5A4.7050504@zijn-digital.com
обсуждение исходный текст
Ответ на Error in PlPython procedure  (mars_osrp <mars_osrp@yahoo.com>)
Список pgsql-general
mars_osrp wrote:
> Hi All,
>
> I am using PlPython procedure to insert data in a table:
>
> plan = plpy.execute("insert into test(id,name) values(1 , 'test_py')")
>
> I am getting error:
> ERROR:  invalid input syntax for integer: "<PLyResult object at 0x374a5a70>"
>
> In fact preparing a plan and passing a list of values for columns is also
> giving same error.
>
> What is correct valid input syntax for integer in PlPython?
>

Shouldn't that be "plpy.prepare(...)" instead of the execute() method? I
think what you want is:

plan = plpy.prepare("INSERT INTO test (id, name) VALUES ($1, $2)",
["integer", "text"])

res = plpy.execute(plan, [1, "test_py"])

Or something like that. pl/Python error messages are definitely pretty
cryptic, though.

b

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

Предыдущее
От: Stephen Davies
Дата:
Сообщение: ts_headline
Следующее
От: Dee
Дата:
Сообщение: Install problem w/8.3 on windows 2000 : application failed to initialize properly (0xc0000022)