From: | 杨伯宇(长堂) <yangboyu(dot)yby(at)alibaba-inc(dot)com> |
---|---|
To: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | function "cursor_to_xmlschema" causes a crash |
Date: | 2023-09-18 05:00:59 |
Message-ID: | dd343010-c637-434c-a8cb-418f53bda3b8.yangboyu.yby@alibaba-inc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
Attachment | Content-Type | Size |
---|---|---|
0001-fix-cursor_to_xmlschema-can-cause-a-crash.patch | application/octet-stream | 705 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Suraj Kharage | 2023-09-18 05:50:41 | Re: Server crash on RHEL 9/s390x platform against PG16 |
Previous Message | David Rowley | 2023-09-18 04:08:55 | Re: Speed up transaction completion faster after many relations are accessed in a transaction |