[#3852] Fix for Oracle. Switch NULL / DEFAULT order in DDL
This commit is contained in:
parent
b4485dec44
commit
88be6eb510
@ -253,6 +253,9 @@ final class CreateTableImpl<R extends Record> extends AbstractQuery implements
|
||||
.sql(' ');
|
||||
Tools.toSQLDDLTypeDeclaration(ctx, type);
|
||||
|
||||
if (asList().contains(ctx.family()))
|
||||
acceptDefault(ctx, type);
|
||||
|
||||
if (type.nullable()) {
|
||||
|
||||
// [#4321] Not all dialects support explicit NULL type declarations
|
||||
@ -263,8 +266,8 @@ final class CreateTableImpl<R extends Record> extends AbstractQuery implements
|
||||
ctx.sql(' ').keyword("not null");
|
||||
}
|
||||
|
||||
if (type.defaulted())
|
||||
ctx.sql(' ').keyword("default").sql(' ').visit(type.defaultValue());
|
||||
if (!asList().contains(ctx.family()))
|
||||
acceptDefault(ctx, type);
|
||||
|
||||
if (i < columnFields.size() - 1)
|
||||
ctx.sql(',').formatSeparator();
|
||||
@ -290,6 +293,11 @@ final class CreateTableImpl<R extends Record> extends AbstractQuery implements
|
||||
}
|
||||
}
|
||||
|
||||
private void acceptDefault(Context<?> ctx, DataType<?> type) {
|
||||
if (type.defaulted())
|
||||
ctx.sql(' ').keyword("default").sql(' ').visit(type.defaultValue());
|
||||
}
|
||||
|
||||
private final void acceptCreateTableAsSelect(Context<?> ctx) {
|
||||
ctx.start(CREATE_TABLE);
|
||||
toSQLCreateTableName(ctx);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user