Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

hive creation of temp tables in default database during an INSERT?

New Contributor

I have an INSERT statement, using the VALUES clause on a table that is formatted ORC and this table is not in the default database. When this INSERT attempts to run I get the following permissions error.

Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: HiveAccessControlException Permission denied: user [cdp8.admin] does not have [SELECT] privilege on [default/values__tmp__table__1/*]

Does my user [cdp8.admin] need the SELECT privilege on the default database even though I'm not using it?


Master Mentor

@Michael Napoleon

The problem seems to be around the default temporary table (at least, it is failing here before anything else). The query you make with the "VALUES" part work like this :

- it creates a temporary hive table with the line to be inserted

- it then queries that temporary table for inserting the data into the target table

From the output I see, the temporary table is created [default/values__tmp__table__1]. But the user does not have "select" permission on it.

I guess that a workaround would be to grant "SELECT" on the database "default" but this could bring some security issues for you (since the user will have read permission on all the tables inside "default").

New Contributor

Any idea if the temporary table created with the line to be inserted has to in the "default" database? Is there a setting to modify this behavior in hive such that I can tell it to use a database the user does have access to?

Cloudera Employee

Hello Michael, 


In your insert query are you referring to table like "databasename.tablename"?, if yes, then first try to execute 


"use databasename" 


And then execute the query.