agora inbox for [email protected]
help / color / mirror / Atom feedFrom: Alvaro Herrera <[email protected]>
Subject: [PATCH v25 7/9] perminfoindex is unsigned; also, test for 0
Date: Wed, 16 Nov 2022 12:27:46 +0100
---
src/backend/parser/parse_relation.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 5fd01965a4..92ead7d8be 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -3749,14 +3749,15 @@ GetRTEPermissionInfo(List *rtepermlist, RangeTblEntry *rte)
{
RTEPermissionInfo *perminfo;
- Assert(rte->perminfoindex > 0);
- if (rte->perminfoindex > list_length(rtepermlist))
- elog(ERROR, "invalid perminfoindex %u in RTE with relid %u",
+ if (rte->perminfoindex == 0 ||
+ rte->perminfoindex > list_length(rtepermlist))
+ elog(ERROR, "invalid perminfoindex %d in RTE with relid %u",
rte->perminfoindex, rte->relid);
perminfo = list_nth_node(RTEPermissionInfo, rtepermlist,
rte->perminfoindex - 1);
if (perminfo->relid != rte->relid)
elog(ERROR, "permission info at index %u (with relid=%u) does not match requested RTE (with relid=%u)",
rte->perminfoindex, perminfo->relid, rte->relid);
+
return perminfo;
}
--
2.30.2
--3sqhherzatux5zde
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v25-0008-Note-assert-is-redundant.-Remove-it.patch"
view thread (2+ messages)
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH v25 7/9] perminfoindex is unsigned; also, test for 0
In-Reply-To: <no-message-id-123907@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox