berkmancenter / tagteam

Enhanced Social Tagging for Academic Communities
http://tagteam.harvard.edu/
GNU Affero General Public License v3.0
94 stars 30 forks source link

PG::UndefinedFunction error on visiting /hub_feeds/1/tags #39

Open zackw opened 6 years ago

zackw commented 6 years ago

Attempting to visit the "tags" screen for an RSS feed gave me this error mail:

A ActionView::Template::Error occurred in tags#index:

  PG::UndefinedFunction: ERROR:  function count(tags, bigint) does not exist
LINE 1: SELECT COUNT(tags.*, count(*)) AS count_tags_all_count_all, ...
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
: SELECT COUNT(tags.*, count(*)) AS count_tags_all_count_all, tags.id AS tags_id FROM "tags" INNER JOIN "taggings" ON "taggings"."tag_id" = "tags"."id" WHERE "taggings"."taggable_id" IN (94, 11, 7, 9, 17, 7
6, 25, 35, 6, 73, 65, 55, 66, 50, 8, 75, 33, 2, 74, 3, 22, 47, 27, 53, 21, 97, 48, 99, 63, 72, 52, 81, 95, 84, 20, 16, 29, 43, 28, 54, 18, 68, 49, 87, 56, 1, 46, 10, 79, 78, 39, 86, 61, 93, 77, 67, 12, 34,
19, 82, 37, 26, 62, 15, 31, 32, 100, 80, 41, 14, 83, 42, 44, 85, 24, 23, 51, 70, 45, 13, 91, 98, 92, 71, 57, 58, 40, 36, 30, 64, 38, 4, 69, 96, 88, 59, 90, 60, 89, 5) AND "taggings"."taggable_type" = $1 AND
 "taggings"."context" = $2 GROUP BY tags.id
  app/views/tags/_statistics.html.haml:3:in `_app_views_tags__statistics_html_haml___490173671537779269_47242388495760'

-------------------------------
Request:
-------------------------------

  * URL       : https://iclab-tagteam.cs.umass.edu/hub_feeds/1/tags
  * IP address: 128.237.152.112
  * Parameters: {"controller"=>"tags", "action"=>"index", "hub_feed_id"=>"1"}
  * Rails root: /home/tagteam/tagteam
  * Timestamp : 2017-11-27 11:37:07 -0500

-------------------------------
Session:
-------------------------------

  * session id: [FILTERED]
  * data: #<ActionDispatch::Request::Session:0x0055eef2ebee98 ...>

-------------------------------
Environment:
-------------------------------

  * HTTPS                                          : on
  * HTTP_ACCEPT                                    : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  * HTTP_ACCEPT_ENCODING                           : gzip, deflate, br
  * HTTP_ACCEPT_LANGUAGE                           : en-US,en;q=0.5
  * HTTP_COOKIE                                    : [REDACTED]
  * HTTP_DNT                                       : 1
  * HTTP_HOST                                      : iclab-tagteam.cs.umass.edu
  * HTTP_REFERER                                   : https://iclab-tagteam.cs.umass.edu/hubs/1/hub_feeds/1
  * HTTP_UPGRADE_INSECURE_REQUESTS                 : 1
  * HTTP_USER_AGENT                                : Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
  * HTTP_VERSION                                   : HTTP/1.1
  * ORIGINAL_FULLPATH                              : /hub_feeds/1/tags
  * ORIGINAL_SCRIPT_NAME                           :
  * PASSENGER_CONNECT_PASSWORD                     : [FILTERED]
  * PATH_INFO                                      : /hub_feeds/1/tags
  * QUERY_STRING                                   :
  * REMOTE_ADDR                                    : 128.237.152.112
  * REMOTE_PORT                                    : 36476
  * REQUEST_METHOD                                 : GET
  * REQUEST_URI                                    : /hub_feeds/1/tags
  * ROUTES_47242365302540_SCRIPT_NAME              :
  * SCRIPT_NAME                                    :
  * SECRET_KEY_BASE                                : [REDACTED]
  * SERVER_NAME                                    : iclab-tagteam.cs.umass.edu
  * SERVER_PORT                                    : 443
  * SERVER_PROTOCOL                                : HTTP/1.1
  * SERVER_SOFTWARE                                : Apache/2.4.25 (Debian) Phusion_Passenger/5.0.30
  * SSL_TLS_SNI                                    : iclab-tagteam.cs.umass.edu
  * action_controller.instance                     : tags#index
  * action_dispatch.backtrace_cleaner              : #<Rails::BacktraceCleaner:0x0055eeee3a16b8>
  * action_dispatch.cookies                        : #<ActionDispatch::Cookies::CookieJar:0x0055eef2d87c50>
  * action_dispatch.cookies_digest                 :
  * action_dispatch.cookies_serializer             : hybrid
  * action_dispatch.encrypted_cookie_salt          : encrypted cookie
  * action_dispatch.encrypted_signed_cookie_salt   : signed encrypted cookie
  * action_dispatch.http_auth_salt                 : http authentication
  * action_dispatch.key_generator                  : #<ActiveSupport::CachingKeyGenerator:0x0055eef358b618>
  * action_dispatch.logger                         : #<ActiveSupport::Logger:0x0055eef0c7bc28>
  * action_dispatch.parameter_filter               : [:password, :password_confirmation, "SHARED_KEY_FOR_TASKS", :password]
  * action_dispatch.redirect_filter                : []
  * action_dispatch.remote_ip                      : 128.237.152.112
  * action_dispatch.request.content_type           :
  * action_dispatch.request.formats                : [#<Mime::Type:0x0055eeef03a0f0 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html", @hash=-1567514111316129883>]
  * action_dispatch.request.parameters             : {"controller"=>"tags", "action"=>"index", "hub_feed_id"=>"1"}
  * action_dispatch.request.path_parameters        : {:controller=>"tags", :action=>"index", :hub_feed_id=>"1"}
  * action_dispatch.request.query_parameters       : {}
  * action_dispatch.request.request_parameters     : {}
  * action_dispatch.request.unsigned_session_cookie: [REDACTED]
  * action_dispatch.request_id                     : 5be141bb-62ae-41a1-a6eb-35e1fddd77f0
  * action_dispatch.routes                         : #<ActionDispatch::Routing::RouteSet:0x0055eef0cdee18>
  * action_dispatch.secret_key_base                : [REDACTED]
  * action_dispatch.secret_token                   :
  * action_dispatch.show_detailed_exceptions       : false
  * action_dispatch.show_exceptions                : true
  * action_dispatch.signed_cookie_salt             : signed cookie
  * exception_notifier.options                     : {:sender_address=>"no_reply@iclab-tagteam.cs.umass.edu", :exception_recipients=>"[REDACTED]", :email_prefix=>"[tagteam-errors] ", :sections=>["request", "session", "environment", "backtrace"], :background_sections=>["backtrace", "data"], :verbose_subject=>true, :normalize_subject=>false, :ignore_exceptions=>[Acl9::AccessDenied, ActionController::RoutingError, ActiveRecord::RecordNotFound], :ignore_crawlers=>[], :ignore_if=>#<Proc:0x0055eef39b8538@/home/tagteam/tagteam/vendor/bundle/ruby/2.3.0/gems/exception_notification-2.6.1/lib/exception_notifier.rb:30 (lambda)>}
  * rack.errors                                    : #<IO:0x0055eeede15aa0>
  * rack.hijack                                    : #<Proc:0x0055eef2ece0f0@/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:84 (lambda)>
  * rack.hijack?                                   : true
  * rack.input                                     : #<PhusionPassenger::Utils::TeeInput:0x0055eef2ece348>
  * rack.multiprocess                              : true
  * rack.multithread                               : false
  * rack.request.cookie_hash                       : [REDACTED]
  * rack.request.cookie_string                     : [REDACTED]
  * rack.request.query_hash                        : {}
  * rack.request.query_string                      :
  * rack.run_once                                  : false
  * rack.session                                   : #<ActionDispatch::Request::Session:0x0055eef2ebee98>
  * rack.session.options                           : #<ActionDispatch::Request::Session::Options:0x0055eef2ebed58>
  * rack.url_scheme                                : https
  * rack.version                                   : [1, 2]
  * warden                                         : Warden::Proxy:47242383062520 @config={:default_scope=>:user, :scope_defaults=>{}, :default_strategies=>{:user=>[:rememberable, :database_authenticatable]}, :intercept_401=>false, :failure_app=>#<Devise::Delegator:0x0055eeee008b78>}

  * Process: 12002
  * Server : iclab-tagteam

-------------------------------
Backtrace:
-------------------------------

  app/views/tags/_statistics.html.haml:3:in `_app_views_tags__statistics_html_haml___490173671537779269_47242388495760'
  app/views/tags/index.html.haml:7:in `block in _app_views_tags_index_html_haml__2263552932550779094_47242381466000'
  app/views/tags/index.html.haml:5:in `_app_views_tags_index_html_haml__2263552932550779094_47242381466000'
  app/controllers/tags_controller.rb:58:in `block (2 levels) in index'
  app/controllers/tags_controller.rb:57:in `index'

Looking at the offending database tables, I don't see how BIGINT managed to come into it:

tagteam_production=> select count(*) from tags;
 count
-------
   173
(1 row)

tagteam_production=> select count(*) from taggings;
 count
-------
   808
(1 row)

tagteam_production=> \d tags
                                 Table "public.tags"
 Column |          Type          |                     Modifiers
--------+------------------------+---------------------------------------------------
 id     | integer                | not null default nextval('tags_id_seq'::regclass)
 name   | character varying(255) |

tagteam_production=> \d taggings
                                       Table "public.taggings"
    Column     |            Type             |                       Modifiers
---------------+-----------------------------+-------------------------------------------------------
 id            | integer                     | not null default nextval('taggings_id_seq'::regclass)
 tag_id        | integer                     |
 taggable_id   | integer                     |
 taggable_type | character varying(255)      |
 tagger_id     | integer                     |
 tagger_type   | character varying(255)      |
 context       | character varying(255)      |
 created_at    | timestamp without time zone |
zackw commented 6 years ago

Incidentally, all of the individual item pages (e.g. /hub_feeds/1/feed_items/1) show up with no tags at all, even though the input RSS feed has lots of tags; could that be another symptom of the same problem? There's no errors in production.log for that page load, though.