Page MenuHomePhabricator

Sonarqube recommands "varchar2" data type, well it doesn't exist
Closed, ResolvedPublic

Description

I get this comment by sonarqube in all of my abstract schema patches (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/617828/1/maintenance/postgres/tables-generated.sql)

Well, the problem is that this datatype only exists in Oracle and doesn't exist in mysql, sqlite, or postgres, making this completely useless.

MariaDB [repo]> CREATE TABLE /*_*/log_searchwow (
    ->   ls_field VARBINARY(32) NOT NULL,
    ->   ls_value VARCHAR2(255) NOT NULL,
    ->   ls_log_id INT UNSIGNED DEFAULT 0 NOT NULL,
    ->   INDEX ls_log_id (ls_log_id),
    ->   PRIMARY KEY(ls_field, ls_value, ls_log_id)
    -> ) /*$wgDBTableOptions*/;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VARCHAR2(255) NOT NULL,
  ls_log_id INT UNSIGNED DEFAULT 0 NOT NULL,
  INDEX ls_' at line 3

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 2 2020, 10:36 PM

Ping? Still happening, sill annoying.

kostajh added a subscriber: Gehel.Sep 14 2020, 6:35 PM

Sorry I missed the ping. I will disable the rule (cc @Gehel). Do you have a more recent example you can link to please?

kostajh closed this task as Resolved.Sep 15 2020, 7:40 AM
kostajh claimed this task.

OK, I've copied the default PL/SQL quality profile and disabled the varchar2 rule: https://sonarcloud.io/organizations/wmftest/quality_profiles/show?language=plsql&name=MediaWiki