【问题标题】:I can't get the complete list of tables using jooq 3.9.1 from Postgres databse我无法从 Postgres 数据库中获取使用 jooq 3.9.1 的完整表列表
【发布时间】:2018-07-26 21:28:23
【问题描述】:

我正在按如下方式创建表:

CREATE TABLE plist1 (c1 NUMERIC, c2 VARCHAR(10)) PARTITION BY
LIST (c1)

当我尝试从 Postgres 数据库中读取完整的表列表时,包括我们用于分区的主表。

有趣的是,当我使用标准 java.sql.connection 和 java.sql.DatabaseMetadata 类的独立程序时,我可以看到完整的表列表如下:

public void getTableListFromConn() throws Exception {
    Class.forName("org.postgresql.Driver");
    Connection con = DriverManager.getConnection(
            "jdbc:postgresql://<hostname>:5432/postgres", "<username>",
            "<password>");
    System.out.println("Product name is : " + con.getMetaData().getDatabaseProductName());
    ResultSet rs = null;
    rs = con.getMetaData().getTables(null, null, null, new String[] { "TABLE" });
    int count = 0;
    while (rs.next()) {
        String catName = rs.getString("TABLE_CAT");
        String schemaName = rs.getString("TABLE_SCHEM");
        String tableName = rs.getString("TABLE_NAME");
        System.out.println("Cat : " + catName + " schemaname : " + schemaName + " tableName : " + tableName);
    }
    System.out.println("Count is : " + count);
}

从博客https://www.javacodegeeks.com/2014/08/integrating-jooq-with-postgresql-partitioning.html我读到jooq不直接支持分区。

无论如何,我们是否可以使用 JOOQ 库获得完整的表列表。

【问题讨论】:

    标签: postgresql partitioning jooq


    【解决方案1】:

    我确定这不是问题 jooq 而是我使用的是一个非常旧的 postgresql 版本,但是从 42.1.2 版本开始引入了支持。

    请查看以下网址 version_42.1.2

    【讨论】:

      猜你喜欢
      • 2015-07-31
      • 1970-01-01
      • 1970-01-01
      • 2017-06-09
      • 2019-09-02
      • 1970-01-01
      • 2018-09-30
      • 2015-11-12
      • 2022-01-02
      相关资源
      最近更新 更多