Skip site navigation (1) Skip section navigation (2)

BUG #4774: Bug with use execute+xml+xml_encode_special_chars

From: "Nickolay" <boks(at)doci(dot)in(dot)ua>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4774: Bug with use execute+xml+xml_encode_special_chars
Date: 2009-04-22 15:00:52
Message-ID: 200904221500.n3MF0qxb093788@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
The following bug has been logged online:

Bug reference:      4774
Logged by:          Nickolay
Email address:      boks(at)doci(dot)in(dot)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.

Responses

pgsql-hackers by date

Next:From: Robert CampbellDate: 2009-04-22 15:03:05
Subject: Re: Workaround for bug #4608?
Previous:From: Bruce MomjianDate: 2009-04-22 15:00:16
Subject: Re: psql with "Function Type" in \df

pgsql-bugs by date

Next:From: Robert CampbellDate: 2009-04-22 15:03:05
Subject: Re: Workaround for bug #4608?
Previous:From: Robert CampbellDate: 2009-04-22 14:36:56
Subject: Re: Workaround for bug #4608?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group