title: Why is my created postgres user being denied access to a table?
body: <p>I have created a user for my Postgres database but I cannot access the data with the user that I set up.</p>
  
  <p>In a python shell I have run the following code:</p>
  
  <pre><code>&gt;&gt;&gt; import psycopg2
  
  &gt;&gt;&gt; conn=psycopg2.connect(
  database="db",
  user="postgres",
  host="/tmp/",
  password="opensesame"
  )
  
  &gt;&gt;&gt; cur = conn.cursor()
  
  &gt;&gt;&gt; state = 'Arkansas'
  
  &gt;&gt;&gt; cur.execute("SELECT city FROM table WHERE state = %s", (state,))
  
  Traceback (most recent call last):
    File "&lt;pyshell#8&gt;", line 1, in &lt;module&gt;
      cur.execute("SELECT city FROM table WHERE state = %s", (state,))
  ProgrammingError: permission denied for relation table
  </code></pre>
  
  <p>As the superuser, I have tried:</p>
  
  <pre><code>db=# ALTER USER postgres SET TO default
  </code></pre>
  
  <p>but it did not help</p>
  
  <p>I need to get this user access to this table, any help would be appreciated.  Thank you for viewing.</p>