title: Remove locks without a pid in postgres
body: <p>I am using PostgreSQL 9.6.1 on Amazon Web Services RDS</p>
  
  <p>How can I remove the locks below? I was expecting a PID to remove, but they are empty in this example.</p>
  
  <pre><code>business_data=&gt; CREATE OR REPLACE VIEW public.active_locks AS
  business_data-&gt;  SELECT t.schemaname,
  business_data-&gt;     t.relname,
  business_data-&gt;     l.locktype,
  business_data-&gt;     l.page,
  business_data-&gt;     l.virtualtransaction,
  business_data-&gt;     l.pid,
  business_data-&gt;     l.mode,
  business_data-&gt;     l.granted
  business_data-&gt;    FROM pg_locks l
  business_data-&gt;    JOIN pg_stat_all_tables t ON l.relation = t.relid
  business_data-&gt;   WHERE t.schemaname &lt;&gt; 'pg_toast'::name AND t.schemaname &lt;&gt; 'pg_catalog'::name
  business_data-&gt;   ORDER BY t.schemaname, t.relname;
  CREATE VIEW
  business_data=&gt; SELECT * FROM active_locks;
   schemaname |               relname                | locktype | page | virtualtransaction | pid |      mode       | granted
  ------------+--------------------------------------+----------+------+--------------------+-----+-----------------+---------
   public     | passengercar                         | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarcover                    | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarcoveria                  | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercardriver                   | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarinsuredamount            | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarmore                     | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercaror                       | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarpassengercar             | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarrequest                  | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarrequest_requestedcovers  | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarresponse                 | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarresponse_requestedcovers | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarresponseia               | relation |      | -1/226452          |     | AccessShareLock | t
   public     | passengercarresponseor               | relation |      | -1/226452          |     | AccessShareLock | t
  (14 rows)
  </code></pre>
  
  <p>Info from <code>pg_stat_activity</code></p>
  
  <pre><code>business_data=&gt; select datname,pid,usename,wait_event,wait_event_type,query from pg_stat_activity;
      datname    |  pid  |   usename    | wait_event | wait_event_type |                                       query
  ---------------+-------+--------------+------------+-----------------+------------------------------------------------------------------------------------
   rdsadmin      |  1804 | rdsadmin     |            |                 | &lt;insufficient privilege&gt;
   business_data |  5384 | bd_admin     |            |                 | SELECT 1
   bonita        |  5650 | bonita_admin |            |                 | SHOW TRANSACTION ISOLATION LEVEL
   business_data |  5385 | bd_admin     |            |                 | SELECT 1
   business_data | 19304 | bd_admin     |            |                 | SELECT COUNT(*) FROM (SELECT * FROM "public".passengercarresponse) C2668
   bonita        |  5497 | bonita_admin |            |                 | SHOW TRANSACTION ISOLATION LEVEL
   business_data |  5386 | bd_admin     |            |                 | SELECT 1
   business_data |  5387 | bd_admin     |            |                 | SELECT 1
   bonita        |  5498 | bonita_admin |            |                 | COMMIT
   bonita        |  5543 | bonita_admin |            |                 | SHOW TRANSACTION ISOLATION LEVEL
   business_data |  5495 | ia_admin     |            |                 | select datname,pid,usename,wait_event,wait_event_type,query from pg_stat_activity;
   db_l7_umg     | 26442 | umg_admin    |            |                 | SELECT COUNT(*) FROM (SELECT * FROM dbo.abz) C2668
   bonita        | 25981 | bonita_admin |            |                 | SELECT gid FROM pg_prepared_xacts
   business_data | 25982 | bd_admin     |            |                 | SELECT gid FROM pg_prepared_xacts
   business_data | 26619 | ia_admin     |            |                 | select datname,pid,usename,query from pg_stat_activity where waiting ;
  (15 rows)
  </code></pre>