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.

feita há 6 anos626 visualizações
2 Respostas
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.

respondido há 6 anos
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.

respondido há 6 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas