message: extracting subquery as separate view
  mariadb 10.1 does not support subquerries in a `FROM` yet.
diff: @@ -86,20 +86,17 @@ CREATE TABLE IF NOT EXISTS project_ssh_key (
  );
  -DROP view IF EXISTS foo;
  -CREATE VIEW foo
  +DROP VIEW IF EXISTS pid_skid;
  +CREATE VIEW pid_skid
  AS
  - SELECT skid, GROUP_CONCAT(DISTINCT r.pid SEPARATOR ',')
  - FROM
  - (SELECT
  + SELECT DISTINCT
  p.id as pid, csk.skid as skid
  - FROM project p
  - INNER JOIN customer c ON p.customer = c.id
  - INNER JOIN customer_ssh_key csk ON csk.cid = c.id
  + FROM customer_ssh_key csk
  + INNER JOIN customer c ON csk.cid = c.id
  + INNER JOIN project p ON p.customer = c.id
  UNION DISTINCT
  SELECT psk.pid AS pid, psk.skid as skid
  - FROM project_ssh_key psk) r;
  -
  + FROM project_ssh_key psk;
  DROP VIEW IF EXISTS permission;
  CREATE VIEW permission
  @@ -113,14 +110,7 @@ AS
  WHERE csk.skid = sk.id) as customers,
  (SELECT GROUP_CONCAT(DISTINCT r.pid SEPARATOR ',')
  FROM
  - (SELECT DISTINCT
  - p.id as pid, csk.skid as skid
  - FROM customer_ssh_key csk
  - INNER JOIN customer c ON csk.cid = c.id
  - INNER JOIN project p ON p.customer = c.id
  - UNION DISTINCT
  - SELECT psk.pid AS pid, psk.skid as skid
  - FROM project_ssh_key psk) r
  + pid_skid AS r
  WHERE r.skid = sk.id
  ) AS projects
  FROM ssh_key sk;
  