Skip to content

Commit c6c31c4

Browse files
committed
test: cover PostgreSQL 18 inline check enforcement
Signed-off-by: minleejae <mmj9808@gmail.com>
1 parent 8a673f4 commit c6c31c4

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎src/test/java/net/sf/jsqlparser/statement/create/MySqlInlineCheckTest.java‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ void preservesFollowingColumnOptions(String tail) throws JSQLParserException {
8181
Dialect.MYSQL);
8282
}
8383

84+
@ParameterizedTest
85+
@ValueSource(strings = {"", " NO INHERIT"})
86+
void preservesPostgreSql18InlineCheckEnforcement(String inheritance)
87+
throws JSQLParserException {
88+
CreateTable table = (CreateTable) parse(
89+
"CREATE TABLE t (a INT CHECK (a > 0)" + inheritance + " NOT ENFORCED)",
90+
Dialect.POSTGRESQL);
91+
CheckConstraint check = assertInstanceOf(CheckConstraint.class,
92+
table.getColumnDefinitions().get(0).getColumnOptions().get(0).getConstraint());
93+
assertEquals(false, check.getEnforced());
94+
assertEquals(!inheritance.isEmpty(), check.isNoInherit());
95+
roundTrip(table, Dialect.POSTGRESQL);
96+
}
97+
8498
private static Statement parse(String sql, Dialect dialect) throws JSQLParserException {
8599
return CCJSqlParserUtil.parse(sql, p -> {
86100
if (dialect != null) {

0 commit comments

Comments
 (0)