Now I have removed python 2.7. Restarted the postgresql. When I call the above mentioned function, now server doesn't crash. It is running, but I get the error 'No connection to the server'. I am using PgAdmin to work with Postgresql. I tried to execute a simple function to show python version or path, but still I am getting the same error. I tried to execute other plpython function but still the same problem. I can use other plsql and sql functions correctly.
When checked the log file it have entries like this:
2011-08-24 11:19:57 IST LOG: database system was interrupted; last known up at 2011-08-10 22:25:38 IST
2011-08-24 11:19:57 IST LOG: database system was not properly shut down; automatic recovery in progress
2011-08-24 11:19:57 IST FATAL: the database system is starting up
2011-08-24 11:19:57 IST LOG: consistent recovery state reached at 0/424E9800
2011-08-24 11:19:57 IST LOG: redo starts at 0/424E9800
2011-08-24 11:19:57 IST LOG: record with zero length at 0/424EFC70
2011-08-24 11:19:57 IST LOG: redo done at 0/424EFC30
2011-08-24 11:19:57 IST LOG: last completed transaction was at log time 2011-08-10 22:27:35.06+05:30
2011-08-24 11:19:57 IST LOG: database system is ready to accept connections
2011-08-24 11:19:58 IST LOG: autovacuum launcher started
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
This last line is added every time I call any plpython function. Here is the simple plpython function.
CREATE OR REPLACE FUNCTION software.pyver()
RETURNS text AS
$BODY$
import sys
#return sys.version
return sys.path
$BODY$
LANGUAGE plpythonu VOLATILE
COST 100;
What is the problem?
Chaitany Kulkarni
On Mon, Aug 22, 2011 at 8:08 PM, Adrian Klaver <adrian.klaver@xxxxxxxxx> wrote:
On Monday, August 22, 2011 7:24:30 am c k wrote:My guess is this is the clue:
> No i didn't removed any thing. Only I have installed python 2.6. And then
> tried to create plpythonu. It got created, but when tries to execute
> already mentioned function server crashes.
>
> I didn't have any clue.
It is very possible you have a version cross reference going on. In other words
"First I installed python 2.7 and then added python installation
path to windows PATH variable. ..."
pl/pythonu is being compiled against one version of Python, but run against
another. If it is possible I would remove the Python 2.7 installation or at
least the references to it and then recompile pl/pythonu.
--
>
> Thanks and regards.
>
> Chaitany Kulkarni
>