[PATCH] Fix incorrect parser comment

Started by David Christensen8 months ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t53087
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 27, 2026 at 04:57 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t53087_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t53087_1 && git checkout t53087_1

Patchset v1 (message #1) is on t53087_1

Jump to latest
#1David Christensen
david@pgguru.net

Noted when doing some other unrelated changes; these are RoleSpec
nodes, not String. This comment has been wrong for ~ 10 years. :D

Attachments:

t53087_1
0001-Fix-incorrect-parser-comment.patchapplication/octet-stream; name=0001-Fix-incorrect-parser-comment.patchDownload+1-2
#2Chao Li
li.evan.chao@gmail.com
In reply to: David Christensen (#1)
Re: [PATCH] Fix incorrect parser comment

On Jan 15, 2026, at 03:26, David Christensen <david@pgguru.net> wrote:

Noted when doing some other unrelated changes; these are RoleSpec
nodes, not String. This comment has been wrong for ~ 10 years. :D
<0001-Fix-incorrect-parser-comment.patch>

I think this is a good catch. The error isn't immediately obvious at a glance.

To provide the fix:

```
typedef struct GrantRoleStmt
{
NodeTag type;
List *granted_roles; /* list of roles to be granted/revoked */
List *grantee_roles; /* list of member roles to add/delete */
```

grantee_roles is defined as a List in GrantRoleStmt, and it is passed to roleSpecsToIds():

```
grantee_ids = roleSpecsToIds(stmt->grantee_roles);
```

Then roleSpecsToIds() iterates the list with type RoleSpec:

```
List *
roleSpecsToIds(List *memberNames)
{
List *result = NIL;
ListCell *l;

foreach(l, memberNames)
{
RoleSpec *rolespec = lfirst_node(RoleSpec, l);
Oid roleid;

roleid = get_rolespec_oid(rolespec, false);
result = lappend_oid(result, roleid);
}
return result;
}
```

So, the fix LGTM.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

#3Michael Paquier
michael@paquier.xyz
In reply to: David Christensen (#1)
Re: [PATCH] Fix incorrect parser comment

On Wed, Jan 14, 2026 at 01:26:03PM -0600, David Christensen wrote:

Noted when doing some other unrelated changes; these are RoleSpec
nodes, not String. This comment has been wrong for ~ 10 years. :D

Indeed, thanks. Adding that to my stack for later.
--
Michael