title: Removal of Role PostgreSQL Failed - cache lookup failed for database
body: <p>This is my first time using PostgreSQL for production. </p>
  
  <p>I made a database <code>blog_production</code> with username <code>blog_production</code> and generated password from gemfile <code>capistrano-postgresql</code>. Once it is generated, I tried to delete database <code>blog_production</code> with this command from terminal:</p>
  
  <p><code>$ sudo -u postgres dropdb blog_production</code></p>
  
  <p>After that I tried to delete user <code>blog_production</code> with this command:</p>
  
  <p><code>$ sudo -u postgres droprole blog_production</code></p>
  
  <p>And it returned <code>dropuser: removal of role "blog_production" failed: ERROR:  cache lookup failed for database 16417</code></p>
  
  <p>1.) Why is this happening? <br>
  2.) I also tried to delete from <code>psql</code> using <code>DELETE FROM pg_roles WHERE rolname='blog_production'</code> but it returned the same error (cache lookup failed)<br>
  3.) How do I solve this problem? </p>
  
  <p>Thank you.</p>
  
  <p><strong>Additional Information</strong> <br>
  PostgreSQL Version
  <code>PostgreSQL 9.1.15 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit
  (1 row)</code></p>
  
  <p><code>select * from pg_shdepend where dbid = 16417;</code></p>
  
  <pre><code> dbid  | classid | objid | objsubid | refclassid | refobjid | deptype 
  -------+---------+-------+----------+------------+----------+---------
   16417 |    1259 | 16419 |        0 |       1260 |    16418 | o
   16417 |    1259 | 16426 |        0 |       1260 |    16418 | o
   16417 |    1259 | 16428 |        0 |       1260 |    16418 | o
  (3 rows)
  </code></pre>
  
  <p><code>select * from pg_database where oid = 16417;</code></p>
  
  <pre><code> datname | datdba | encoding | datcollate | datctype | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | dattablespace | datacl 
  ---------+--------+----------+------------+----------+---------------+--------------+--------------+---------------+--------------+---------------+--------
  (0 rows)
  </code></pre>
  
  <p><code>select * from pg_authid where rolname = 'blog_production'</code></p>
  
  <pre><code>     rolname     | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcatupdate | rolcanlogin | rolreplication | rolconnlimit |             rolpassword             | rolvaliduntil 
  -----------------+----------+------------+---------------+-------------+--------------+-------------+----------------+--------------+-------------------------------------+---------------
   blog_production | f        | t          | f             | f           | f            | t           | f              |           -1 | md5d4d2f8789ab11ba2bd019bab8be627e6 | 
  (1 row)
  </code></pre>