Patan
Patan

Reputation: 23

I can't get the complete list of tables using jooq 3.9.1 from Postgres databse

I am creating the table as follows:

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

When I tried to read the complete list of tables from the Postgres database including the master tables that we have used for partitioning.

Interestingly when I have used the stand alone program with standard java.sql.connection and java.sql.DatabaseMetadata classes I could see the complete list of tables as follows:

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);
}

From the blog https://www.javacodegeeks.com/2014/08/integrating-jooq-with-postgresql-partitioning.html I read that jooq is not supporting partitioning directly.

Is there anyway that we get the complete list of tables using the JOOQ library.

Upvotes: 1

Views: 324

Answers (1)

Patan
Patan

Reputation: 23

I identified it that it is not the problem jooq instead I was using a very older postgresql version, but the support was introduced from the version 42.1.2 onwards.

Please checkout the following URL version_42.1.2

Upvotes: 0

Related Questions