Skip to content
Advertisement

Teradata locks table for read while accessing to table through view with access rights

This is really weird.

I have 2 view, one with access rights and other with read rights to table.

replace view v1_read as locking row for read
select id1 from t1;

replace view v2_access as locking row for access
select id2 from t2;

Then I run such select query and look explain plan:

select id1, id2
from v2_access left join v1_read on v2_access.id2=v1_read.id1;

Teradata blocks table t2 for read, but it should block for access. Is it bug?

I can say Teradata to start it block for access manually this way:

lock table t2 for access -- before the query

However there is the problem with such solution – administrators does not give such grants.

  • TD Release: 15.10.03.07

  • TD Version: 15.10.03.09

How can I fix that?

Advertisement

Answer

If you write such select query with join without specifying anything, TD will get max rights from both view. So this is why t2 blocked for read.

  1. Always check blocks with explain
  2. If you arent agree, manually block it lock table t2 for access
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement