Found in 8.4.2, replicated in HEAD. Steps:
1. Create PL/Perl function.
2. Run it.
3. Create same function with PL/PerlU
4. Run it.
5. Create same function again with PL/Perl
6. Boom.
Example on HEAD built today (ignore the error from the plperl version, that=
's the issue I'm trying to fix locally):
postgres=3D# create or replace function wtf(text) returns text language plp=
erl as 'shift';
CREATE FUNCTION
Time: 151.054 ms
postgres=3D# select wtf('hey');
ERROR: invalid byte sequence for encoding "UTF8": 0x00
CONTEXT: PL/Perl function "wtf"
postgres=3D# create or replace function wtf(text) returns text language plp=
erlu as 'shift';
CREATE FUNCTION
Time: 41.255 ms
postgres=3D# select wtf('hey');
wtf=20
-----
hey
(1 row)
Time: 0.523 ms
postgres=3D# create or replace function wtf(text) returns text language plp=
erl as 'shift';
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.