BUG #4774: Bug with use execute+xml+xml_encode_special_chars - Mailing list pgsql-bugs

From Nickolay
Subject BUG #4774: Bug with use execute+xml+xml_encode_special_chars
Date
Msg-id 200904221500.n3MF0qxb093788@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4774: Bug with use execute+xml+xml_encode_special_chars
Re: BUG #4774: Bug with use execute+xml+xml_encode_special_chars
Re: BUG #4774: Bug with use execute+xml+xml_encode_special_chars
List pgsql-bugs
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.

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #4773: Logging error
Next
From: Tom Lane
Date:
Subject: Re: BUG #4774: Bug with use execute+xml+xml_encode_special_chars