           FROM `information_schema`.`tables`
           WHERE `table_schema` = sname
           AND `table_type` = 'BASE TABLE'
-        )
-     ) msng;
+      )
+   ) msng;
 
   RETURN COALESCE(ret, '');
 END //

END //


-- table_character_set_is( schema, table, character_set, description )
DROP FUNCTION IF EXISTS table_character_set_is //
CREATE FUNCTION table_character_set_is(sname VARCHAR(64), tname VARCHAR(64), cname VARCHAR(32), description TEXT)
RETURNS TEXT
BEGIN
  IF description = '' THEN
    SET description = CONCAT('Table ', quote_ident(sname), '.',
      quote_ident(tname), ' should have Character Set ',  quote_ident(cname));
  END IF;

  IF NOT _has_table(sname, tname) THEN
    RETURN CONCAT(ok( FALSE, description), '\n', 
      diag(CONCAT('    Table ', quote_ident(sname), '.', quote_ident(tname), ' does not exist')));
  END IF;

  IF NOT _has_charset( cname ) THEN
    RETURN CONCAT(ok(FALSE, description), '\n', 
      diag(CONCAT('    Character Set ', quote_ident(cname), ' is not available')));
  END IF;

  RETURN eq(_table_character_set( sname, tname), cname, description);
END //



BEGIN
  IF description = '' THEN
    SET description = concat('Table ', quote_ident(sname), '.',
      quote_ident(tname), ' should have Collation ',  qv(cname));
  END IF;

  IF NOT _has_table(sname, tname) THEN
    RETURN CONCAT(ok(FALSE, description), '\n', 
      diag(CONCAT('    Table ', quote_ident(sname), '.', 
        quote_ident(tname), ' does not exist')));
  END IF;

  IF NOT _has_collation(cname) THEN
    RETURN CONCAT(ok(FALSE, description), '\n', 
      diag (CONCAT('    Collation ', quote_ident(cname), ' is not available')));
  END IF;

  RETURN eq(_table_collation(sname, tname), cname, description);
