Re: Multiline plpython procedure

Поиск
Список
Период
Сортировка
От Hong Yuan
Тема Re: Multiline plpython procedure
Дата
Msg-id 41EC8C58.5010900@homemaster.cn
обсуждение исходный текст
Ответ на Re: Multiline plpython procedure  (Adrian Klaver <aklaver@comcast.net>)
Ответы Re: Multiline plpython procedure  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Adrian Klaver wrote:

>On Monday 17 January 2005 01:54 am, Hong Yuan wrote:
>I entered the multilineversion of this function exactly as written here and it
>ran properly. This was with version 8.0 of Postgres.  You might want to do
>a /df+ circ in psql to see if your editor is putting a space at the beginning
>of line 2.
>
>
The strange thing is that if I create the function in psql, the function
works. But if I create the function from PgAdmin III, there was an
error, although with \df+ circ I can not identify any visual difference
between the two versions of function. See below:


.... I create the function with psql ....

homemaster=# \df+ circ
                                            List of functions
 Result data type | Schema | Name | Argument data types |  Owner  |
Language  | Source code | Description
------------------+--------+------+---------------------+---------+-----------+-------------+-------------
 double precision | public | circ | double precision    | zopeapp |
plpythonu |
from math import pi
return 2*pi*args[0]            |
(1 row)

homemaster=# select circ(1);
     circ
---------------
 6.28318530718
(1 row)

.... Now I recreate the function with pgAdmin ....

homemaster=# \df+ circ
                                            List of functions
 Result data type | Schema | Name | Argument data types |  Owner  |
Language  | Source code | Description
------------------+--------+------+---------------------+---------+-----------+-------------+-------------
 double precision | public | circ | double precision    | zopeapp |
plpythonu |
from math import pi
return 2*pi*args[0]            |
(1 row)

homemaster=# select circ(1);
ERROR:  plpython: could not compile function "circ"
DETAIL:  exceptions.SyntaxError: invalid syntax (line 2)

I suppose there are some invisible characters inserted into the function
body by pgAdmin. I am using pgAdmin III Version 1.2.0 under Chinese
Windows XP, while the database is 7.4.6 under Linux.

Should be a bug of pgAdmin with encoding or something. At least I know
the workaround now. Thanks.

--
HONG Yuan
Homemaster Trading Co., Ltd.
No. 601, Bldg. 41, 288 Shuangyang Rd. (N)
Shanghai 200433, P.R.C.
Tel: +86 21 55056553
Fax: +86 21 55067325
E-mail: hongyuan@homemaster.cn


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

Предыдущее
От: William Yu
Дата:
Сообщение: Re: ext3
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Logging question