PGError:错误:关系“ delayed_jobs”不存在(PostgreSQL,rails 3.04,delayed_job错误) [英] PGError: ERROR: relation "delayed_jobs" does not exist (Postgresql, rails 3.04, delayed_job error)
问题描述
我做了 rake db:create
,然后<< c $ c> rake db:migrate 并遇到了这个错误。
I did rake db:create
and then rake db:migrate
and ran into this error.
rake aborted!
PGError: ERROR: relation "delayed_jobs" does not exist
LINE 4: WHERE a.attrelid = '"delayed_jobs"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"delayed_jobs"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
推荐答案
您的查询将 delayed_jobs转换为regclass,这将表的名称转换为PostgreSQL的内部ID号。如果无法进行转换,则会出现错误:
SELECT‘foo’:: regclass;
错误:关系 foo不存在
Your query is casting "delayed_jobs" to a regclass, which translates the name of a table to PostgreSQL's internal ID number. If the cast can't be made you get the error: SELECT 'foo'::regclass; ERROR: relation "foo" does not exist
大概是您的迁移脚本应该捕获此错误并创建表(也许问题是它已经认为了
Presumably your migrate script should be catching this error and creating the table (maybe the problem is it already thinks it has done so).
PS -您的问题标题没有帮助。 PostgreSQL使用 delayed_job没有问题。您不仅没有一个表格 delayed_job,而且问题显然也与Rail的创建或迁移脚本有关。
P.S. - The title of your question isn't helpful. PostgreSQL doesn't have a problem working with "delayed_job". Not only don't you have a table "delayed_job" but the problem is clearly with Rail's create or migrate scripts.
这篇关于PGError:错误:关系“ delayed_jobs”不存在(PostgreSQL,rails 3.04,delayed_job错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!