HAS_TABLE_PRIVILEGE query failing

0

Hi,
I use the Redshift admin views for quite a lot, and noticed that at least one of them no longer works for some reason. I'm unsure if it's due to a recent maintenance period or something else. The view in question is: https://github.com/awslabs/amazon-redshift-utils/blob/master/src/AdminViews/v_get_tbl_priv_by_user.sql

Here's the error I get

ERROR:  3F000: schema "pg_temp_118" does not exist
LOCATION:  LookupExplicitNamespace, /home/ec2-user/padb/src/pg/src/backend/catalog/namespace.c:1338

I distilled the query down to this, and it still fails:

SELECT
        schemaname
        ,tablename
        ,HAS_TABLE_PRIVILEGE('admin', schemaname || '.' || tablename, 'select') AS sel
FROM pg_tables;

Removing the cross join (and almost everything else) didn't fix it. However, it works if I remove the HAS_TABLE_PRIVILEGE field, so it appears to be a problem with that function.

질문됨 6년 전618회 조회
2개 답변
0

I tested this on numerous versions and am not able to reproduce the issue.

Recommend dropping and recreating the view as a first step.

Also check that your user is a superuser or you have limited the results to items on which you have permissions.

답변함 6년 전
0

Note that I tested a straight select on pg_tables, and it threw an error, regardless of the view, or what user ran the query.

However testing it now works, which is strange. It must have just been a temporary thing. Nothing appears to have changed.

답변함 6년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠