# Fix PostgreSQL User Has No Permission for Table Error

> Resolve the Postgres permission error by changing table ownership with ALTER TABLE OWNER TO or granting specific privileges with GRANT SELECT ON

**URL:** https://sentry.io/answers/has-no-permission-for-table/

---

## The Problem

If you come across the error `user <user> has no permission for table <table>` when trying to run queries using a certain table, you are missing the correct permissions in the Postgres database. A common reason for this is creating a table using the `postgres` default user, then trying to access said table using a different user. The creator of a table has to explicitly grant other users permission to query that table.

## The Solution

If these permissions are the problem, you can change the ownership of a table using a SQL query (note you'll need to run this query as the owner of the table or a superuser).

```sql
ALTER TABLE "my_table" OWNER TO "new_owner";
```

However, the more common solution is to use the GRANT keyword to give other users the permission you want on the table. The following query will grant SELECT access to another user.

```sql
GRANT SELECT ON "my_table" to "bob";
```

This will allow the `bob` user to run SELECT queries on `my_table`. You can read about the full specification for GRANT here: [PostgreSQL GRANT documentation](https://www.postgresql.org/docs/current/sql-grant.html)

### Further Reading

If you're looking to get a deeper understanding of how database application monitoring works, take a look at the following articles:

- [Database Performance Monitoring in Node](https://blog.sentry.io/support-for-database-performance-monitoring-in-node/)
- [How to mutate data in a system designed for immutable data](https://blog.sentry.io/how-to-mutate-data-in-a-system-designed-for-immutable-data/)
- [Tracking database queries with Spans (docs)](https://docs.sentry.io/platforms/javascript/guides/node/)

---

*Source: [sentry.io/answers/has-no-permission-for-table/](https://sentry.io/answers/has-no-permission-for-table/)*
