Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #2152

Closed
Open
Created Dec 02, 2012 by Administrator@rootOwner

postgresql compatibility

Created by: jozefvaclavik

I dont run MySQL in production. I was running gitlab with Sqlite and I have other apps running PostgreSQL, so I migrated my gitlab db there.

During Note queries gitlab crashes. The problem is that notable_id is type string

#db/schema.rb
  create_table "notes", :force => true do |t|
    t.text     "note"
    t.string   "noteable_id"
    t.string   "noteable_type"
    t.integer  "author_id"
    t.datetime "created_at",    :null => false
    t.datetime "updated_at",    :null => false
    t.integer  "project_id"
    t.string   "attachment"
    t.string   "line_code"
  end

If I want to list issues, it always crash with this error:

ActionView::Template::Error (PG::Error: ERROR:  operator does not exist: character varying = integer
LINE 1: ...OUNT(*) FROM "notes"  WHERE "notes"."noteable_id" = 1 AND "n...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT COUNT(*) FROM "notes"  WHERE "notes"."noteable_id" = 1 AND "notes"."noteable_type" = 'Issue'):
    8:         %i.icon-tag
    9:         = label.name
    10:     - if issue.notes.any?
    11:       %span.btn.small.disabled.grouped
    12:         %i.icon-comment
    13:         = issue.notes.count
    14:     - if can? current_user, :modify_issue, issue
  app/views/issues/_show.html.haml:11:in `_app_views_issues__show_html_haml__4204629861026802996_29641400'
  app/views/issues/_issues.html.haml:2:in `block in _app_views_issues__issues_html_haml__1440201310527625046_31074860'
  app/views/issues/_issues.html.haml:1:in `_app_views_issues__issues_html_haml__1440201310527625046_31074860'
  app/views/issues/index.html.haml:59:in `_app_views_issues_index_html_haml___1391241433070931356_55924840'
  app/controllers/issues_controller.rb:23:in `index'

Postgres doesn't like that notable_id is string and its trying to search by integer.

Assignee
Assign to
Time tracking