尝试诊断 ActiveRecord::ConcurrentMigrationError 时缺少 pg_locks 和 pg_stat_activity 表

Missing pg_locks and pg_stat_activity tables while trying to diagnose ActiveRecord::ConcurrentMigrationError

我有一个停滞的 Rails 迁移,所以我 ctrl-C 退出它并尝试重新 运行 它。我收到以下错误:

ActiveRecord::ConcurrentMigrationError: 

Cannot run migrations because another migration process is currently running.

我已经尝试了 中的解决方案。我 运行 以下命令,但没有产生输出:

richiethomas=# \c re_app_development
psql (9.6.11, server 11.2)
WARNING: psql major version 9.6, server major version 11.
         Some psql features might not work.
You are now connected to database "re_app_development" as user "richiethomas".

re_app_development=# SELECT DISTINCT age(now(), query_start) AS age, pg_stat_activity.pid,pg_locks.granted,pg_stat_activity.application_name,pg_stat_activity.backend_start, pg_stat_activity.xact_start, pg_stat_activity.state_change, pg_stat_activity.waiting, pg_stat_activity.state, pg_stat_activity.query_start, left(pg_stat_activity.query, 60)
re_app_development-#     FROM pg_stat_activity, pg_locks
re_app_development-#     WHERE pg_locks.pid = pg_stat_activity.pid
re_app_development-# 

我很困惑为什么没有输出,所以我开始寻找 pg_lockspg_stat_activity 表。下面是我数据库中的所有表(请注意,我稍微重新 运行 表的顺序,将我创建的表分组到底部组,以及 Rails 或我生成的表宝石进入第一组):

re_app_development-# \dt
                   List of relations
 Schema |          Name          | Type  |    Owner     
--------+------------------------+-------+--------------
 public | ar_internal_metadata   | table | richiethomas
 public | flipper_features       | table | richiethomas
 public | flipper_gates          | table | richiethomas
 public | schema_migrations      | table | richiethomas

 public | reports                | table | richiethomas
 public | users                  | table | richiethomas
 public | categories             | table | richiethomas
 public | responses              | table | richiethomas
 public | zip_code_hpis          | table | richiethomas
 public | zip_codes              | table | richiethomas
(13 rows)

如您所见,上面查询中的两个表都丢失了。

我唯一能想到的是选择数据库时的警告与这里相关:

WARNING: psql major version 9.6, server major version 11.
         Some psql features might not work.

我的问题是 - 我在哪里可以找到这些表,以便我可以解除锁定并重新运行 我的迁移?

我从来不知道丢失的两个表在哪里,但我可以通过简单地 运行 brew services stop postgresql 然后 brew services start postgresql 删除 advisory_lock。不必删除我的数据库或任何东西。 :-)