[#3133] Code generation marks all Postgresql Fields as having a default
value
This commit is contained in:
parent
ff3f9186cd
commit
dc6996d8aa
@ -41,6 +41,7 @@
|
||||
|
||||
package org.jooq.util.postgres;
|
||||
|
||||
import static org.jooq.tools.StringUtils.isBlank;
|
||||
import static org.jooq.util.postgres.information_schema.Tables.COLUMNS;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@ -92,7 +93,7 @@ public class PostgresTableDefinition extends AbstractTableDefinition {
|
||||
record.getValue(COLUMNS.NUMERIC_PRECISION),
|
||||
record.getValue(COLUMNS.NUMERIC_SCALE),
|
||||
record.getValue(COLUMNS.IS_NULLABLE, boolean.class),
|
||||
record.getValue(COLUMNS.COLUMN_DEFAULT.nvl("")) != null,
|
||||
!isBlank(record.getValue(COLUMNS.COLUMN_DEFAULT.nvl(""))),
|
||||
record.getValue(COLUMNS.UDT_NAME)
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.0.0.xsd">
|
||||
<jdbc>
|
||||
<driver>org.postgresql.Driver</driver>
|
||||
<url>jdbc:postgresql:postgres</url>
|
||||
<url>jdbc:postgresql://localhost:5434/postgres</url>
|
||||
<schema>information_schema</schema>
|
||||
<user>postgres</user>
|
||||
<password>test</password>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.0.0.xsd">
|
||||
<jdbc>
|
||||
<driver>org.postgresql.Driver</driver>
|
||||
<url>jdbc:postgresql:postgres</url>
|
||||
<url>jdbc:postgresql://localhost:5434/postgres</url>
|
||||
<schema>pg_catalog</schema>
|
||||
<user>postgres</user>
|
||||
<password>test</password>
|
||||
|
||||
@ -49,6 +49,7 @@ import static org.jooq.SQLDialect.CUBRID;
|
||||
// ...
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
// ...
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
@ -105,6 +106,14 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMetaFieldTypes() throws Exception {
|
||||
|
||||
// [#3133] Check if DEFAULT information is correctly generated
|
||||
assertFalse(TBook_ID().getDataType().defaulted());
|
||||
assertTrue(TBook_LANGUAGE_ID().getDataType().defaulted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMetaModel() throws Exception {
|
||||
|
||||
|
||||
@ -1146,6 +1146,11 @@ public abstract class jOOQAbstractTest<
|
||||
new MetaDataTests(this).testMetaModel();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMetaFieldTypes() throws Exception {
|
||||
new MetaDataTests(this).testMetaFieldTypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMetaData() throws Exception {
|
||||
new MetaDataTests(this).testMetaData();
|
||||
|
||||
@ -317,7 +317,7 @@ CREATE TABLE t_book (
|
||||
details_id INT,
|
||||
title VARCHAR(400) NOT NULL,
|
||||
published_in INTEGER NOT NULL,
|
||||
language_id INTEGER NOT NULL,
|
||||
language_id INTEGER NOT NULL DEFAULT 1,
|
||||
content_text TEXT,
|
||||
content_pdf BYTEA,
|
||||
status u_book_status,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user