Github user kaspersorensen commented on a diff in the pull request:
https://github.com/apache/metamodel/pull/185#discussion_r212811641
--- Diff:
jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcCreateTableBuilder.java ---
@@ -115,21 +115,23 @@ private String createSqlStatement(Table table) {
sb.append(" NOT NULL");
}
}
- boolean primaryKeyExists = false;
- for (int i = 0; i < columns.size(); i++) {
- if (columns.get(i).isPrimaryKey()) {
- if (!primaryKeyExists) {
- sb.append(", PRIMARY KEY(");
- sb.append(columns.get(i).getName());
- primaryKeyExists = true;
- } else {
- sb.append(",");
- sb.append(columns.get(i).getName());
+ if (queryRewriter.isPrimaryKeySupported()) {
+ boolean primaryKeyExists = false;
--- End diff --
I don't think it's that easy unfortunately. The abstract class is in the
`core` module so it does not have access to `IQueryRewriter` which is a `jdbc`
module specific interface. The purpose in the abstract class is really just to
have a string (SQL) representation of the operation, where as here it is
similar, but that string representation will actually be used to perform the
operation with the JDBC driver.
---