The following bug has been logged online:
Bug reference: 4774
Logged by: Nickolay
Email address: boks@doci.in.ua
PostgreSQL version: 8.3.5
Operating system: Linux app 2.6.18-92.1.1.el5.028stab057.2 #1 SMP Mon Jul
21 17:08:31 MSD 2008 x86_64 x86_64 x86_64 GNU/Linux
Description: Bug with use execute+xml+xml_encode_special_chars
Details:
Hello. It's definitely a bug:
Code:"
CREATE OR REPLACE FUNCTION bbb()
RETURNS xml AS
$BODY$
BEGIN
execute 'select public.xml_encode_special_chars(''1+1'')';
return '<v>Hello</v>';
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE STRICT SECURITY DEFINER
"
first execute answer: "<v>Hello</v>"
log file:"
LOG: команда: select bbb()
LOG: команда: SELECT format_type(oid,-1) as typname FROM pg_type
WHERE oid = 142
LOG: команда: SELECT CASE WHEN typbasetype=0 THEN oid else
typbasetype END AS basetype
FROM pg_type WHERE oid=142
"
second execute answer: "********** Error **********"
log file:"
LOG: команда: select bbb()
LOG: пÑоÑеÑÑ ÑеÑвеÑа (PID 1483) was terminated by signal 11:
Segmentation fault
LOG: завеÑÑение лÑбÑÑ
дÑÑгиÑ
акÑивнÑÑ
ÑеÑвеÑнÑÑ
пÑоÑеÑÑов
WARNING: закÑÑÑие подÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ Ð¿Ð¾ пÑиÑине
Ñпада дÑÑгого ÑеÑвеÑного пÑоÑеÑÑа
ÐÐÐÐ ÐÐÐÐСТÐ: 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.
ÐÐÐСÐÐÐÐÐ: In a moment you should be able to reconnect to the
database and repeat your command.
WARNING: закÑÑÑие подÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ Ð¿Ð¾ пÑиÑине
Ñпада дÑÑгого ÑеÑвеÑного пÑоÑеÑÑа
ÐÐÐÐ ÐÐÐÐСТÐ: 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.
ÐÐÐСÐÐÐÐÐ: In a moment you should be able to reconnect to the
database and repeat your command.
LOG: вÑе ÑеÑвеÑнÑе пÑоÑеÑÑÑ Ð·Ð°Ð²ÐµÑÑенÑ...
пеÑеиниÑиализаÑиÑ
LOG: database system was interrupted; last known up at 2009-04-22 17:52:18
EEST
LOG: ÑиÑÑема баз даннÑÑ
бÑла непÑавилÑно
оÑÑановлена; пÑоизводиÑÑÑ
авÑомаÑиÑеÑкое воÑÑÑановление
LOG: запиÑÑ Ñ Ð½Ñлевой Ð´Ð»Ð¸Ð½Ð½Ð¾Ñ Ð² 0/21FDE0E8
LOG: REDO (повÑоÑиÑÑ) не ÑÑебÑеÑÑÑ
LOG: checkpoint starting: shutdown immediate
LOG: checkpoint complete: wrote 0 buffers (0.0%); 0 transaction log file(s)
added, 0 removed, 0 recycled; write=0.000 s, sync=0.000 s, total=0.123 s
LOG: autovacuum launcher started
LOG: database system is ready to accept connections
"
Interesting, functions:"
CREATE OR REPLACE FUNCTION bbb1()
RETURNS text AS
$BODY$
BEGIN
execute 'select public.xml_encode_special_chars(''1+1'')';
return '<v>Hello</v>';
END;
$BODY$
"
and
"
CREATE OR REPLACE FUNCTION bbb2()
RETURNS xml AS
$BODY$
BEGIN
-- execute 'select public.xml_encode_special_chars(''1+1'')';
return '<v>Hello</v>';
END;
$BODY$
" works correctly.