mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
#2089 Postgres - Support NO KEY option with FOR UPDATE clauses with Postgres
This commit is contained in:
1 parent
ed061fb3b1
commit
5082ce4280
5 files changed
+18
-16
No files matched your search
@@ -73,7 +73,7 @@ public class ServerConfigTest {
|
||||
props.setProperty("caseSensitiveCollation", "false");
|
||||
props.setProperty("loadModuleInfo", "true");
|
||||
props.setProperty("collectQueryPlanThresholdMicros", "10000");
|
||||
props.setProperty("lockWithKey", "true");
|
||||
props.setProperty("lockWithKey", "false");
|
||||
|
||||
serverConfig.loadFromProperties(props);
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ServerConfigTest {
|
||||
|
||||
assertTrue(serverConfig.isIdGeneratorAutomatic());
|
||||
assertFalse(serverConfig.getPlatformConfig().isCaseSensitiveCollation());
|
||||
assertTrue(serverConfig.getPlatformConfig().isLockWithKey());
|
||||
assertFalse(serverConfig.getPlatformConfig().isLockWithKey());
|
||||
|
||||
assertThat(serverConfig.getNamingConvention()).isInstanceOf(MatchingNamingConvention.class);
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ public class PostgresPlatformTest {
|
||||
PlatformConfig config = new PlatformConfig();
|
||||
platform.configure(config);
|
||||
|
||||
assertThat(config.isLockWithKey()).isFalse();
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.SKIPLOCKED)).isEqualTo("X for no key update skip locked");
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.NOWAIT)).isEqualTo("X for no key update nowait");
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.BASE)).isEqualTo("X for no key update");
|
||||
assertThat(config.isLockWithKey()).isTrue();
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.SKIPLOCKED)).isEqualTo("X for update skip locked");
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.NOWAIT)).isEqualTo("X for update nowait");
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.BASE)).isEqualTo("X for update");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -41,13 +41,13 @@ public class PostgresPlatformTest {
|
||||
DatabasePlatform platform = new PostgresPlatform();
|
||||
|
||||
PlatformConfig config = new PlatformConfig();
|
||||
config.setLockWithKey(true);
|
||||
config.setLockWithKey(false);
|
||||
platform.configure(config);
|
||||
|
||||
assertThat(config.isLockWithKey()).isTrue();
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.SKIPLOCKED)).isEqualTo("X for update skip locked");
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.NOWAIT)).isEqualTo("X for update nowait");
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.BASE)).isEqualTo("X for update");
|
||||
assertThat(config.isLockWithKey()).isFalse();
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.SKIPLOCKED)).isEqualTo("X for no key update skip locked");
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.NOWAIT)).isEqualTo("X for no key update nowait");
|
||||
assertThat(platform.withForUpdate("X", Query.ForUpdate.BASE)).isEqualTo("X for no key update");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user