Skip to content

Commit

Permalink
[#15934] Code generator and MetaImpl return CREATE DEFAULT
Browse files Browse the repository at this point in the history
statement instead of just the default expression
  • Loading branch information
lukaseder committed Mar 5, 2024
1 parent 71f25ca commit ff76459
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
4 changes: 4 additions & 0 deletions jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ protected final DSLContext create(boolean muteExceptions) {
// separator is illegal
configuration.settings().setNamePathSeparator("__");

// [#15934] The parser might expose dialect specific behaviour, e.g.
// when parsing defaults.
configuration.settings().setParseDialect(configuration.dialect());

if (muteExceptions) {
return DSL.using(configuration);
}
Expand Down
19 changes: 13 additions & 6 deletions jOOQ/src/main/java/org/jooq/impl/MetaImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1397,13 +1397,20 @@ private final void initColumns(Result<Record> columns) {
}
else {
try {
type = type.defaultValue(dsl()
DSLContext ctx = dsl()
.configuration()
.deriveSettings(s -> s.withParseUnknownFunctions(ParseUnknownFunctions.IGNORE))
.dsl()
.parser()
.parseField(defaultValue)
);
.deriveSettings(s -> s
.withParseDialect(dialect())
.withParseUnknownFunctions(ParseUnknownFunctions.IGNORE))
.dsl();







type = type.defaultValue(ctx.parser().parseField(defaultValue));
}
catch (ParserException e) {
log.info("Cannot parse default expression (to skip parsing, use Settings.parseMetaViewDefaultExpressions): " + defaultValue, e);
Expand Down
13 changes: 13 additions & 0 deletions jOOQ/src/main/java/org/jooq/impl/ParserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -8575,6 +8575,19 @@ private final FieldOrRow parseTerm() {
















switch (characterUpper()) {

// [#8821] Known prefixes so far:
Expand Down

0 comments on commit ff76459

Please sign in to comment.