ERROR: '' You do not have permissions to run native ad-hoc queries against database 3. ''

THE ERROR: ‘’ You do not have permissions to run native ad-hoc queries against database 3. ‘’
After upgrading the metabase to version 35.02, I am unable to save questions to my personal collection. But I have access to those tables. Would you help me?


Hi @brunasiq
Please post “Diagnostic Info” from Admin > Troubleshooting.
And see if there’s a more detailed error in Admin > Troubleshooting > Logs.

Hi @flamber,

My users, who do not have Query access to the database but have access to the tables, are also facing similar issues in our environment. I thought this was resolved according to this.

Could you please help us debug this?

Here’s a screenshot, if it helps:


@teja Post “Diagnostic Info” from Admin > Troubleshooting.

Here you go, @flamber:

  "browser-info": {
    "language": "en-US",
    "platform": "MacIntel",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36",
    "vendor": "Google Inc."
  "system-info": {
    "file.encoding": "UTF-8",
    "": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.5+10",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "",
    "java.version": "11.0.5",
    "": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.5+10",
    "": "Linux",
    "os.version": "4.14.171-105.231.amzn1.x86_64",
    "user.language": "en",
    "user.timezone": "GMT"
  "metabase-info": {
    "databases": [
    "hosting-env": "elastic-beanstalk",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "10.6"
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.8"
    "run-mode": "prod",
    "version": {
      "date": "2020-04-10",
      "tag": "v0.35.2",
      "branch": "release-0.35.x",
      "hash": "f3b2857"
    "settings": {
      "report-timezone": "US/Central"


I don’t think I’ve ever seen that error before. Adding as text, so it can be searched in the future: You do not have permissions to run ad-hoc native queries against Database 9

Do you see more details in Admin > Troubleshooting > Logs? (I don’t expect it, just curious)

Can you provide a way to reproduce this? Meaning what permissions, question creation, and if possible use Sample Dataset as the test database, since we all have access to that.

This is the error I see in logs around the time the user posted this issue, if that helps:

[27410c87-6475-41e6-8319-1f7b745f606e] 2020-04-22T09:54:38-05:00 ERROR metabase.models.query.permissions Error calculating permissions for query: Attempting to fetch second Database. Queries can only reference one Database.

I could save the question as I have SQL access to the database.

Just to clarify that even though the log says that it is using a secon database, it is not. I could save the question myself.

@teja Can you provide steps to reproduce this? Can you post the query?

If the users don’t have access to the query, then it’s correct that they cannot save the question, but they shouldn’t even be able to get to that point.

@flamber, just tagging in case

They are not actually writing a query. This is what they did.

  1. Choose a table document from Dotcool DB
  2. Joined the table to another table Account from Dotcool DB
  3. Added relevant filters
  4. Grouped by a field and got the count of rows
  5. Tried to the save the question, but failed with the error.

I should have shared the complete screen shot that they shared, but here it is

This is really strange. With the amount of installations of Metabase, I don’t understand why this problem hasn’t happened more often. It must be some combination of factors that triggers this.

Which database type is “Dotcool”, Redshift?
And the users just have “Data Access” to the entire database, or only to specific tables?
Does this happen with all users on that database, or is it the specific tables, or specific filters that causes the error?

There hasn’t been any changes to the logic behind this permission check for a very long time, so something makes me think that to root cause is somewhere else:


Yes, we are using Redshift for Dotcool.
All users just have access to few specific schemas in the database.

This is the first time that any user has posted this issue. Also, we are a small company, so I wonder how many non-admin users are actually creating their own reports. I am sorry that I couldn’t be of much help on how widely this issue persists.


All users just have access to few specific schemas in the database.

But are they also restricted to specific tables?
The tables Document and Account are in the same schema, right?

Yes, they are both in the same schema, and all users have access to all tables in that schema.

@flamber just wanted to see if you have any solution here.

I noticed that more and more users are facing these issues when they are trying to build new reports from existing questions.

@teja I’m not sure what the trigger is, but I haven’t been able to reproduce this at all. And I haven’t seen anyone (besides this forum topic) report this error.
You’re welcome to open an issue on this, but please try to explain in full details your permission levels and anything else you think might be helpful:

Hello, how are you? did you receive any solution about the error of saving as questions in the collection ??


@brunasiq I haven’t been able to reproduce this, but it would help if you posted “Diagnostic Info” from Admin > Troubleshooting, and provided steps to reproduce the issue or at least information about your database permissions (Admin > Permissions).

I have non-admin users who also have this same error. The only way I have found to circumvent the error is making the user an admin otherwise they get the error: “You do not have permissions to run ad-hoc native queries against Database {x}”. I have verified that permissions exists for the user to run ad-hoc queries and full access to the database.

“browser-info”: {
“language”: “en-US”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36”,
“vendor”: “Google Inc.”
“system-info”: {
“file.encoding”: “UTF-8”,
“”: “OpenJDK Runtime Environment”,
“java.runtime.version”: “11.0.7+10”,
“java.vendor”: “AdoptOpenJDK”,
“java.vendor.url”: “”,
“java.version”: “11.0.7”,
“”: “OpenJDK 64-Bit Server VM”,
“java.vm.version”: “11.0.7+10”,
“”: “Linux”,
“os.version”: “4.14.123-86.109.amzn1.x86_64”,
“user.language”: “en”,
“user.timezone”: “GMT”
“metabase-info”: {
“databases”: [
“hosting-env”: “elastic-beanstalk”,
“application-database”: “postgres”,
“application-database-details”: {
“database”: {
“name”: “PostgreSQL”,
“version”: “10.6”
“jdbc-driver”: {
“name”: “PostgreSQL JDBC Driver”,
“version”: “42.2.8”
“run-mode”: “prod”,
“version”: {
“date”: “2020-05-28”,
“tag”: “v0.35.4”,
“branch”: “release-0.35.x”,
“hash”: “b3080fa”
“settings”: {
“report-timezone”: “US/Mountain”

@wtomlinson If you could provide steps-to-reproduce, then it would be very helpful and then we would be able to get this issue fixed. I have tried multiple times, but I haven’t been able to nail this yet.
From your timezone, I’m guessing you’re in the US and so are your users, so I don’t think it’s a problem with languages in the interface.