From: Andrew Gierth <rhodiumtoad@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix error case for CREATE ROLE ... IN ROLE.
Date: Sat, 25 Apr 2020 04:21:05 +0000
Message-ID: <E1jSCJN-0004JW-9Q@gemulon.postgresql.org> (raw)
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
------
REL_12_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/d0360632d39fca05f6f6e13e98184e72d44c6b3a
Modified Files
--------------
src/backend/commands/user.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: rhodiumtoad@postgresql.org
Subject: Re: pgsql: Fix error case for CREATE ROLE ... IN ROLE.
In-Reply-To: <E1jSCJN-0004JW-9Q@gemulon.postgresql.org>
References: <E1jSCJN-0004JW-9Q@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox