function "cursor_to_xmlschema" causes a crash

Поиск
Список
Период
Сортировка
От 杨伯宇(长堂)
Тема function "cursor_to_xmlschema" causes a crash
Дата
Msg-id dd343010-c637-434c-a8cb-418f53bda3b8.yangboyu.yby@alibaba-inc.com
обсуждение исходный текст
Ответы Re: function "cursor_to_xmlschema" causes a crash  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello postgres hackers:
I recently notice that function "cursor_to_xmlschema" can lead to a crash if the
cursor parameter points to the query itself. Here is an example:

postgres=# SELECT cursor_to_xmlschema('' :: refcursor, TRUE , FALSE , 'xxx' ) into temp;
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

The reason could be that this function doesn't ensure the cursor is correctly
opened, as a "select into" statement can't be opened as a cursor. Although it may
be challenging to perform a perfect check in this scenario, it seems sufficient
just to check the tuple descriptor of the portal, since only the query that
returns tuples can be opened as a cursor.

Only in my opinion, self-pointing cursors like this do not make practical sense.
This bug is discovered through randomly generated SQL statements.

Best regards,
Boyu Yang
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Speed up transaction completion faster after many relations are accessed in a transaction
Следующее
От: Suraj Kharage
Дата:
Сообщение: Re: Server crash on RHEL 9/s390x platform against PG16