#2089 Postgres - Support NO KEY option with FOR UPDATE clauses with Postgres

This commit is contained in:
rob bygrave committed 2020-11-24 22:02:06 +13:00
1 parent ed061fb3b1
commit 5082ce4280
5 files changed
+18 -16

No files matched your search

@@ -35,7 +35,7 @@ public class TestQueryForUpdate extends BaseTestCase {
if (isSqlServer()) {
assertThat(sqlOf(query)).contains("with (updlock)");
} else if (isPostgres()) {
assertThat(sqlOf(query)).contains("for no key update");
assertThat(sqlOf(query)).contains("for update");
} else {
assertThat(sqlOf(query)).contains("for update");
}
@@ -69,7 +69,7 @@ public class TestQueryForUpdate extends BaseTestCase {
assertSql(sql.get(0)).contains("from e_basic t0 where t0.id =");
assertSql(sql.get(1)).contains("from e_basic t0 where t0.id =");
if (isPostgres()) {
assertSql(sql.get(1)).contains("for no key update");
assertSql(sql.get(1)).contains("for update");
} else {
assertSql(sql.get(1)).contains("for update");
}
@@ -97,7 +97,7 @@ public class TestQueryForUpdate extends BaseTestCase {
} else if (isSqlServer()) {
assertThat(sqlOf(query)).contains("with (updlock,nowait)");
} else if (isPostgres()) {
assertThat(sqlOf(query)).contains("for no key update nowait");
assertThat(sqlOf(query)).contains("for update nowait");
} else {
assertThat(sqlOf(query)).contains("for update nowait");
}
@@ -124,7 +124,7 @@ public class TestQueryForUpdate extends BaseTestCase {
} else if (isH2()) {
assertThat(sqlOf(query)).contains("for update");
} else if (isPostgres()) {
assertThat(sqlOf(query)).contains("for no key update nowait");
assertThat(sqlOf(query)).contains("for update nowait");
} else {
assertThat(sqlOf(query)).contains("for update nowait");
}
@@ -5,6 +5,7 @@ import io.ebean.DB;
import io.ebean.annotation.ForPlatform;
import io.ebean.annotation.Platform;
import io.ebean.annotation.Transactional;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -26,6 +27,7 @@ public class TestQueryForUpdatePostgresLock extends BaseTestCase {
private long timePreLock;
private long timePostLock;
@Ignore // restore this test with explicit use of NO KEY lock strength
@Test
@ForPlatform(Platform.POSTGRES)
public void testForUpdatePostgresLock() throws InterruptedException {