3

While defining a PL/Python function in psql, I get the error:

server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

The function:

CREATE OR REPLACE FUNCTION pymax (a integer, b integer) RETURNS integer AS
$$
    if a > b:
      return a
    return b
$$ LANGUAGE plpython3u;

The PostgreSQL log:

2018-01-16 17:17:57.296 IST [8164] LOG:  server process (PID 5128) was terminated by exception 0xC0000409
2018-01-16 17:17:57.296 IST [8164] DETAIL:  Failed process was running: CREATE OR REPLACE FUNCTION pymax (a integer, b integer) RETURNS integer AS
        $$
            if a > b:
              return a
            return b
        $$ LANGUAGE plpython3u;
2018-01-16 17:17:57.296 IST [8164] HINT:  See C include file "ntstatus.h" for a description of the hexadecimal value.
2018-01-16 17:17:57.296 IST [8164] LOG:  terminating any other active server processes
2018-01-16 17:17:57.300 IST [5484] WARNING:  terminating connection because of crash of another server process
2018-01-16 17:17:57.300 IST [5484] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2018-01-16 17:17:57.300 IST [5484] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2018-01-16 17:17:57.324 IST [920] FATAL:  the database system is in recovery mode
2018-01-16 17:17:57.342 IST [8164] LOG:  all server processes terminated; reinitializing
2018-01-16 17:17:57.373 IST [5700] LOG:  database system was interrupted; last known up at 2018-01-16 17:17:41 IST
2018-01-16 17:17:57.993 IST [5700] LOG:  database system was not properly shut down; automatic recovery in progress
2018-01-16 17:17:58.022 IST [5700] LOG:  redo starts at 0/279BA58
2018-01-16 17:17:58.023 IST [5700] LOG:  invalid record length at 0/279BA90: wanted 24, got 0
2018-01-16 17:17:58.023 IST [5700] LOG:  redo done at 0/279BA58
2018-01-16 17:17:58.247 IST [8164] LOG:  database system is ready to accept connections
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
Rahul Gour
  • 487
  • 2
  • 7
  • 21
  • You should tell us if you built PostgreSQL yourself or installed a binary distribution. If, binary, from where did you download PostgreSQL? It would also be interesting which Python you installed and where you got it from. – Laurenz Albe Jan 16 '18 at 12:11
  • installed it from postgresql.org 64 bit version 10 and then installed language pack of perl/python/tcl from this packade only. – Rahul Gour Jan 17 '18 at 06:01
  • postgresql.org doesn't offer PostgreSQL binaries. You'll have to be more specific. And where did you get Python from? – Laurenz Albe Jan 17 '18 at 07:26
  • i used postgresql10.1.3 x64.exe to installed postgresql from enterpriseDB site , didn't use binaries to installed it, then this exe also provide python 3.4 , perl 5.24 and tcl inbuild in language package. – Rahul Gour Jan 17 '18 at 09:44

0 Answers0