pgsql: Fix error case for CREATE ROLE ... IN ROLE.

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема pgsql: Fix error case for CREATE ROLE ... IN ROLE.
Дата
Msg-id E1jSCJN-0004Jf-Aw@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix error case for CREATE ROLE ... IN ROLE.

CreateRole() was passing a Value node, not a RoleSpec node, for the
newly-created role name when adding the role as a member of existing
roles for the IN ROLE syntax.

This mistake went unnoticed because the node in question is used only
for error messages and is not accessed on non-error paths.

In older pg versions (such as 9.5 where this was found), this results
in an "unexpected node type" error in place of the real error. That
node type check was removed at some point, after which the code would
accidentally fail to fail on 64-bit platforms (on which accessing the
Value node as if it were a RoleSpec would be mostly harmless) or give
an "unexpected role type" error on 32-bit platforms.

Fix the code to pass the correct node type, and add an lfirst_node
assertion just in case.

Per report on irc from user m1chelangelo.

Backpatch all the way, because this error has been around for a long
time.

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/86b7a4e6fd7db56022bf49b1c7eb482fdfddf8e5

Modified Files
--------------
src/backend/commands/user.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)


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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: pgsql: Fix handling of WAL segments ready to be archived duringcrash r
Следующее
От: Noah Misch
Дата:
Сообщение: pgsql: In caught-up logical walsender, sleep only in WalSndWaitForWal()