Search Postgresql Archives

Re: Multiline plpython procedure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxx


---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux