Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39c46c5

Browse files
committed
Fix BuildIndexValueDescription for expressions
In804b6b6 we modifiedBuildIndexValueDescription to pay attention to which columns are visibleto the user, but unfortunatley that commit neglected to consider indexeswhich are built on expressions.Handle error-reporting of violations of constraint indexes based onexpressions by not returning any detail when the user does not havetable-level SELECT rights.Backpatch to 9.0, as the prior commit was.Pointed out by Tom.
1 parent53ae246 commit39c46c5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎src/backend/access/index/genam.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,15 @@ BuildIndexValueDescription(Relation indexRelation,
209209
{
210210
AttrNumberattnum=idxrec->indkey.values[keyno];
211211

212-
aclresult=pg_attribute_aclcheck(indrelid,attnum,GetUserId(),
213-
ACL_SELECT);
214-
215-
if (aclresult!=ACLCHECK_OK)
212+
/*
213+
* Note that if attnum == InvalidAttrNumber, then this is an
214+
* index based on an expression and we return no detail rather
215+
* than try to figure out what column(s) the expression includes
216+
* and if the user has SELECT rights on them.
217+
*/
218+
if (attnum==InvalidAttrNumber||
219+
pg_attribute_aclcheck(indrelid,attnum,GetUserId(),
220+
ACL_SELECT)!=ACLCHECK_OK)
216221
{
217222
/* No access, so clean up and return */
218223
ReleaseSysCache(ht_idx);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp