0
我剛剛升級導軌4.1和正在此錯誤:PG ::語法錯誤:錯誤:語法錯誤或接近 「AS」 錯誤的Rails 4.1
PG::SyntaxError: ERROR: syntax error at or near "AS"
LINE 1: SELECT COUNT(count_column) FROM (SELECT * AS count_column F...
^
: SELECT COUNT(count_column) FROM (SELECT * AS count_column FROM (SELECT thread_id, max(id) as id FROM "messages" WHERE 1=0 AND (thread_id IS NOT NULL) GROUP BY thread_id) last JOIN messages ON messages.id = last.id LIMIT 5 OFFSET 0) subquery_for_count
這裏是方法:
- as_myself do
%li#messages-open.icon-btn.email
- message_count = inbox_messages.count.is_a?(Hash) ? inbox_messages.count.values.first : inbox_messages.count
- if(message_count.present? && message_count > 0)
%span= message_count
'SELECT * AS count_column'不是有效的sql語法。它應該像'SELECT AS count_column' –
usha
2014-09-18 19:48:01