using a plpgsql-function and strange behaviour

Started by Konstantinos Agourosabout 25 years ago2 messagesgeneral
Jump to latest
#1Konstantinos Agouros
elwood@agouros.de

Hello,

today I tried the following on 7.0.2:

elwood=# CREATE FUNCTION add_one (int4) RETURNS int4 AS '
elwood'# BEGIN
elwood'# RETURN $1 + 1;
elwood'# END;
elwood'# ' LANGUAGE 'plpgsql';
CREATE
elwood=# select add_one(1);

The result of this was:
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!# \q

The Backend actually died and restarted. Has someone an idea for this, or am
I using the function the wrong way?

Konstantin
--
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@agouros.de
Otkerstr. 28, 81547 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not sustain the forming of the cosmos." B'Elana Torres

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Konstantinos Agouros (#1)
Re: using a plpgsql-function and strange behaviour

Konstantinos Agouros <elwood@agouros.de> writes:

today I tried the following on 7.0.2:

elwood=# CREATE FUNCTION add_one (int4) RETURNS int4 AS '
elwood'# BEGIN
elwood'# RETURN $1 + 1;
elwood'# END;
elwood'# ' LANGUAGE 'plpgsql';
CREATE
elwood=# select add_one(1);

The result of this was:
pqReadData() -- backend closed the channel unexpectedly.

Odd. It works fine for me on 7.0.2:

play=> select add_one(1);
add_one
---------
2
(1 row)

Something broken about your installation, I think, but it's hard
to tell what. Did anything show up in the postmaster log? Is there
a corefile you can get a backtrace from?

regards, tom lane