title: PostgreSQL - relation [table] does not exist
body: <p>I just created a new user that I want to have access to a limited number of our public tables. The user is created and I granted privs to one public table for now. I then logged into the DB as that user and tried to run a SELECT on the table that the user should be able to get to but I must of missed a step or did something wrong because when I run the query I get:</p>
  
  <p><strong>relation [table] does not exist</strong></p>
  
  <p>Below are the steps I took, in order.</p>
  
  <pre><code>CREATE USER pqb2b WITH PASSWORD 'foo'
  
  
   select * from pg_user;
   usename  | usesysid | usecreatedb | usesuper | usecatupd |  passwd   | valuntil | useconfig
   ----------+----------+-------------+----------+-----------+----------+----         |
  postgres |       10 | t           | t        | t         | ******** |          | 
   pgb2b   | 17267767 | t           | f        | f         | ******** | infinity |
  </code></pre>
  
  <p>(1 rows)</p>
  
  <pre><code>GRANT ALL on b_users to pgb2b;
  
  
  
  SELECT
  schemaname||'.'||tablename
  FROM
  pg_tables
  WHERE
  has_table_privilege (
      'pgb2b',
      schemaname||'.'||tablename,
      'select'
   )
  AND
  schemaname NOT IN (
      'pg_catalog',
      'information_schema'
   );
  </code></pre>
  
  <hr>
  
  <pre><code>public.b_users
  (1 row)
  
  
  
  ~ postgres$ psql -U pgb2b  mydb
  psql (9.0.3)
  Type "help" for help.
  
  mydb=&gt; select * from b_users;
  ERROR:  relation "b_users" does not exist
  LINE 1: select * from b_users;
  
   mydb=&gt; \d+ b_users
   Did not find any relation named "b_users".
  </code></pre>