title: Liquibase fails during checking of non-existence of primary key
body: <p>During the replacement of mysql-connector to MariaDB I came to the situation when Liquibase fails on the changeset where I check non-existence of primary key:</p>
  
  <pre><code>    &lt;preConditions onFail="MARK_RAN"&gt;
          &lt;not&gt;
              &lt;primaryKeyExists tableName="users"/&gt;
          &lt;/not&gt;
      &lt;/preConditions&gt;
  </code></pre>
  
  <p>It fails with NullPointerException</p>
  
  <pre><code>Error: null java.lang.NullPointerException at liquibase.snapshot.jvm.MySQLDatabaseSnapshotGenerator.convertPrimaryKeyName(MySQLDatabaseSnapshotGenerator.java:124)
  at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.readPrimaryKeys(JdbcDatabaseSnapshotGenerator.java:759)
  at liquibase.snapshot.jvm.JdbcDatabaseSnapshotGenerator.createSnapshot(JdbcDatabaseSnapshotGenerator.java:243)
  at liquibase.snapshot.DatabaseSnapshotGeneratorFactory.createSnapshot(DatabaseSnapshotGeneratorFactory.java:69)
  at liquibase.precondition.core.PrimaryKeyExistsPrecondition.check(PrimaryKeyExistsPrecondition.java:52)
  at liquibase.precondition.core.NotPrecondition.check(NotPrecondition.java:30)
  at liquibase.precondition.core.AndPrecondition.check(AndPrecondition.java:34)
  at liquibase.precondition.core.PreconditionContainer.check(PreconditionContainer.java:199)
  at liquibase.changelog.ChangeSet.execute(ChangeSet.java:249)
  </code></pre>
  
  <p>If I remove this clause the liquibase works fine. Interesting thing is that other preConditions work fine, for example, which check some table existence.</p>
  
  <p>After diving in the code I found that the issue is in JdbcDatabaseSnapshotGenerator#readPrimaryKeys, where we try to fetch primary keys. But of course, for different databases there are different implementations, so it seems that it is a bit different ResultSet (with null column for primary key) which I get using MariaDB, however, the funny thing is that the method (in MySQLDatabaseSnapshotGenerator) where it fails is like this:</p>
  
  <pre><code>@Override
  protected String convertPrimaryKeyName(String pkName) throws SQLException {
      if (pkName.equals("PRIMARY")) {
          return null;
      } else {
          return pkName;
      }
  }
  </code></pre>
  
  <p>So, just if it is opposite way around it would work for me:) Like this I mean:</p>
  
  <pre><code>if ("PRIMARY".equals(pkName))
  </code></pre>
  
  <p>THE QUESTION: Is it a bug of liquibase or maybe I am doing something wrong?</p>