Issue
I'm trying to setup JOOQ with Postgres and Gradle.
Whenever I run the generate task I get ~ 20 Ambiguous type names
:
Ambiguous type name : The object pg_catalog.generate_series generates a type one.dbtest.db.pg_catalog.tables.GenerateSeries which conflicts with the existing type one.dbtest.db.pg_catalog.tables.GenerateSeries on some operating systems. Use a custom generator strategy to disambiguate the types. Ambiguous type name : The object pg_catalog.generate_series generates a type one.dbtest.db.pg_catalog.tables.GenerateSeries which conflicts with the existing type one.dbtest.db.pg_catalog.tables.GenerateSeries on some operating systems. Use a custom generator strategy to disambiguate the types.
and hundreds of these:
Missing name : Object jsonb_exists_all holds a column without a name at position 2 Missing name : Object jsonb_exists_any holds a column without a name at position 1 Missing name : Object jsonb_exists_any holds a column without a name at position 2 Missing name : Object jsonb_ge holds a column without a name at position 1 Missing name : Object jsonb_ge holds a column without a name at position 2 Missing name
: Object jsonb_gt holds a column without a name at position 1 Missing name : Object jsonb_gt holds a column without a name at position 2 Missing name : Object jsonb_hash holds a column without a name at position 1 Missing name : Object jsonb_in holds a column without a name at position 1 Missing name
: Object jsonb_le holds a column without a name at position 1 Missing name : Object jsonb_le holds a column without a name at position 2 Missing name : Object jsonb_lt holds a column without a name at position 1 Missing name : Object jsonb_lt holds a column without a name at position 2 Missing name
: Object jsonb_ne holds a column without a name at position 1 Missing name : Object jsonb_ne holds a column without a name at position 2
Do I need to exclude the pg* types?
The generate task is taken from the JOOQ samples:
task generate << {
def writer = new StringWriter()
def xml = new groovy.xml.MarkupBuilder(writer)
.configuration("xmlns": "http://www.jooq.org/xsd/jooq-codegen-3.7.0.xsd") {
jdbc() {
driver("org.postgresql.Driver")
url("jdbc:postgresql://localhost/pagila")
user("xxx")
password("xxx")
}
generator() {
database() {
name { mkp.yield( 'org.jooq.util.postgres.PostgresDatabase' ) }
exclude("pg.*")
}
generate() {}
target() {
packageName("one.dbtest.db")
directory("src")
}
}
}
//println writer.toString()
org.jooq.util.GenerationTool.main(
javax.xml.bind.JAXB.unmarshal(
new StringReader(writer.toString()),
org.jooq.util.jaxb.Configuration.class
)
)
}
Updated: DB is pagila from http://pgfoundry.org/projects/dbsamples
Solution
For Postgres you also have to specify the input schema, so it's:
generator() {
database() {
name { mkp.yield( 'org.jooq.util.postgres.PostgresDatabase' ) }
inputSchema("public")
}
[..]
Answered By - laktak
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.