Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-6529

Fail to create manual metrics on MSSQL if DB role db_owner is not granted

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.5
    • Fix Version/s: 4.5.5, 5.2
    • Component/s: Database, Measures
    • Labels:
      None

      Description

      Creating a manual metric fails with a red empty message.

      The column METRICS.QUALITATIVE is supposed to be NOT NULL DEFAULT FALSE but it's not the case on MSSQL 2008 (I didn't test other versions). The problem is that INSERT requests are different depending on user roles :

      • db_datareader + db_datawriter, inserted value is NULL
        ActiveRecord::JDBCError: Cannot insert the value NULL into column 'qualitative', table 'sonar.dbo.metrics'; column does not allow nulls. INSERT fails.: INSERT INTO [metrics] ([name], [description], [direction], [domain], [short_name], [qualitative], [val_type], [user_managed], [enabled], [origin], [worst_value], [best_value], [optimized_best_value], [hidden], [delete_historical_data]) VALUES(N'fooo', N'FOOOO', 0, N'', N'fooo', NULL, N'INT', 1, 1, N'GUI', NULL, NULL, NULL, NULL, NULL)
        
      • db_owner, inserted value is 0
        INSERT INTO [metrics] ([name], [description], [direction], [domain], [short_name], [qualitative], [val_type], [user_managed], [enabled], [origin], [worst_value], [best_value], [optimized_best_value], [hidden], [delete_historical_data]) VALUES(N'bar', N'BAR', 0, N'', N'bar', 0, N'INT', 1, 1, N'GUI', NULL, NULL, NULL, NULL, NULL)
        

      so it fails in the first case but not in the second one.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              simon.brandhof Simon Brandhof (Inactive)
              Reporter:
              simon.brandhof Simon Brandhof (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: