kbendick commented on a change in pull request #3275:
URL: https://github.com/apache/iceberg/pull/3275#discussion_r742422888
##########
File path: core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java
##########
@@ -116,6 +119,19 @@ private void initializeCatalogTables() throws
InterruptedException, SQLException
LOG.debug("Creating table {} to store iceberg catalog",
JdbcUtil.CATALOG_TABLE_NAME);
return conn.prepareStatement(JdbcUtil.CREATE_CATALOG_TABLE).execute();
});
+
+ connections.run(conn -> {
+ DatabaseMetaData dbMeta = conn.getMetaData();
+ ResultSet tableExists = dbMeta.getTables(null, null,
JdbcUtil.CREATE_NAMESPACE_PROPERTIES_TABLE, null);
+
+ if (tableExists.next()) {
+ return true;
Review comment:
So what you referenced in your response to me seems correct.
But the code isn't using `GET_NAMESPACE_SQL` in that `getTables` call. It's
using `CREATE_NAMESPACE_PROPERTIES_SQL`, which is copied at the bottom.
I think you just need to update this line
https://github.com/apache/iceberg/pull/3275/files#diff-a5f7966c7493d463facbf7e76fe0fa3db1b637d29ee12e5b3628a5e5dd289e0aR125
(line 125 above) to use `GET_NAMESPACE_SQL` like you mentioned.
```java
protected static final String CREATE_NAMESPACE_PROPERTIES_TABLE =
"CREATE TABLE " + NAMESPACE_PROPERTIES_TABLE_NAME +
"(" +
CATALOG_NAME + " VARCHAR(255) NOT NULL," +
NAMESPACE_NAME + " VARCHAR(255) NOT NULL," +
NAMESPACE_PROPERTY_KEY + " VARCHAR(5500)," +
NAMESPACE_PROPERTY_VALUE + " VARCHAR(5500)," +
"PRIMARY KEY (" + CATALOG_NAME + ", " + NAMESPACE_NAME + ", " +
NAMESPACE_PROPERTY_KEY + ")" +
")";
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]