1

I have a following jooq-codegen-maven configuration for different DBs:

<plugins>
    <plugin>
        <groupId>org.jooq</groupId>
        <artifactId>jooq-codegen-maven</artifactId>
        <version>${jooq.version}</version>
        <executions>
            <execution>
                <id>generate-1</id>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                    <configurationFile>
                        src/main/resources/jooq/jooq-config-1.xml
                    </configurationFile>
                </configuration>
            </execution>
            <execution>
                <id>generate-2</id>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                    <configurationFile>
                        src/main/resources/jooq/jooq-config-2.xml
                    </configurationFile>
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

jooq-config-1.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.12.0.xsd">
    <jdbc>
        <driver>org.postgresql.Driver</driver>
        <url>jdbc:postgresql://host_pg9_6_11/db</url>
        <user>user</user>
        <password>pass</password>
    </jdbc>
    <generator>
        <database>
            <name>org.jooq.meta.postgres.PostgresDatabase</name>
            <schemata>
                <schema>
                    <inputSchema>billing</inputSchema>
                </schema>
                <schema>
                    <inputSchema>main</inputSchema>
                </schema>
            </schemata>
            <includes>
                (billing.(billing_order|billing_service))|(main.(person|subscription|contact))
            </includes>
        </database>
        <target>
            <packageName>ru.app.postgres.jooq.gen.billing</packageName>
            <directory>target/generated-sources/jooq</directory>
        </target>
    </generator>
</configuration>

jooq-config-2.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.14.0.xsd">
    <jdbc>
        <driver>org.postgresql.Driver</driver>
        <url>jdbc:postgresql://host_pg14_5/db</url>
        <user>user</user>
        <password>pass</password>
    </jdbc>
    <generator>
        <database>
            <name>org.jooq.meta.postgres.PostgresDatabase</name>
            <schemata>
                <schema>
                    <inputSchema>main</inputSchema>
                </schema>
            </schemata>
            <includes>
                f_(start|finish)_load_data
            </includes>
        </database>
        <target>
            <packageName>ru.app.postgres.jooq.gen.track</packageName>
            <directory>target/generated-sources/jooq</directory>
        </target>
    </generator>
</configuration>

The issue is that databases has different Postgres version and I get errors 'column pg_proc.prokind does not exist' or 'column pg_proc.proisagg does not exist' depending on the order of the execution sections. If I remove any of execution section codegen works properly.

It looks like generator plugin detects Postgres version only on the first step.

Is there any way to solve this issue?

I use jooq version: 3.12.3, tried 3.14.4 with the same result.

Postgres versions: 9.6.11 for jooq-config-1 and 14.5 for jooq-config-2.

Java 11, Maven 3.8.1

Y N
  • 56
  • 6
  • Can you please post the full code generation configuration, including the content of your linked XML files? Also, please show the exact PostgreSQL version you're using (or alternatively, if it's not actual PostgreSQL, the RDBMS you're really using). – Lukas Eder Oct 06 '22 at 12:05
  • It doesn't look like there's anything wrong with the configuration. Might be a bug? There used to be such bugs in the past, where more recent PG catalog queries were generated also against older PG versions. Those have been fixed in more recent versions. Perhaps try upgrading again? Neither 3.12.3 nor 3.14.4 are the latest patch releases of the respective minor release, and there had been many more recent releases, too... If you're sure this is a bug, please report it. – Lukas Eder Oct 11 '22 at 10:42

0 Answers0