提交 48329cc4 authored 作者: Thomas Mueller's avatar Thomas Mueller

CREATE FORCE VIEW didn't work in most cases if a referenced table didn't exist.

上级 1a5e654a
...@@ -18,7 +18,17 @@ Change Log ...@@ -18,7 +18,17 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>The built-in connection pool (JdbcConnectionPool) did not always honor the login timeout <ul><li>CREATE FORCE VIEW didn't work in most cases if a referenced table didn't exist.
</li><li>MVCC: when trying to insert two rows with the same key from two connections,
the second connection immediately threw the exception "Unique index or primary key violation".
Instead, the second connection now waits throwing the exception until the first connection
committed the change (same as when trying to concurrently update the same row).
</li><li>Server mode: if the client ran with a different timezone setting than the server, date values
got shifted by the difference between the timezones. This problem affected the data types
DATE, TIME, and TIMESTAMP, when using PreparedStatement.setDate / setTime / setTimestamp
and ResultSet.getDate / getTime / getTimestamp.
To solve the problem, both the client and the server need to be updated (otherwise the old transfer protocol is used).
</li><li>The built-in connection pool (JdbcConnectionPool) did not always honor the login timeout
(the timeout could occur much too early). Thanks a lot to Dario Fassi for the patch! (the timeout could occur much too early). Thanks a lot to Dario Fassi for the patch!
</li><li>Translation: the new messages have been translated to Spanish. Thanks a lot to Dario Fassi! </li><li>Translation: the new messages have been translated to Spanish. Thanks a lot to Dario Fassi!
</li><li>The table INFORMATION_SCHEMA.SETTINGS now contains all H2-specific system properties </li><li>The table INFORMATION_SCHEMA.SETTINGS now contains all H2-specific system properties
......
...@@ -166,19 +166,20 @@ See also <a href="build.html#providing_patches">Providing Patches</a>. ...@@ -166,19 +166,20 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Add H2 to Gem (Ruby install system). </li><li>Add H2 to Gem (Ruby install system).
</li><li>Order conditions inside AND / OR to optimize the performance. </li><li>Order conditions inside AND / OR to optimize the performance.
</li><li>Support Oracle functions: TRUNC, NVL2, TO_CHAR, TO_DATE, TO_NUMBER. </li><li>Support Oracle functions: TRUNC, NVL2, TO_CHAR, TO_DATE, TO_NUMBER.
</li><li>Support linked JCR tables </li><li>Support linked JCR tables.
</li><li>Read InputStream when executing, as late as possible (maybe only embedded mode). Problem with re-execute. </li><li>Read InputStream when executing, as late as possible (maybe only embedded mode). Problem with re-execute.
</li><li>Native fulltext search: min word length; store word positions </li><li>Native fulltext search: min word length; store word positions.
</li><li>Add an option to the SCRIPT command to generate only portable / standard SQL </li><li>Add an option to the SCRIPT command to generate only portable / standard SQL.
</li><li>Updatable Views (simple cases first) </li><li>Updatable Views (simple cases first).
</li><li>Improve create index performance </li><li>Improve create index performance.
</li><li>Implement more JDBC 4.0 features </li><li>Compact databases without having to close the database (vacuum).
</li><li>Support TRANSFORM / PIVOT as in MS Access </li><li>Implement more JDBC 4.0 features.
</li><li>SELECT * FROM (VALUES (...), (...), ....) AS alias(f1, ...) </li><li>Support TRANSFORM / PIVOT as in MS Access.
</li><li>Support updatable views with join on primary keys (to extend a table) </li><li>SELECT * FROM (VALUES (...), (...), ....) AS alias(f1, ...).
</li><li>Public interface for functions (not public static) </li><li>Support updatable views with join on primary keys (to extend a table).
</li><li>Public interface for functions (not public static).
</li><li>Support reading the transaction log. </li><li>Support reading the transaction log.
</li><li>Eliminate undo log records if stored on disk (just one pointer per block, not per record) </li><li>Eliminate undo log records if stored on disk (just one pointer per block, not per record).
</li><li>Feature matrix as in <a href="http://www.inetsoftware.de/products/jdbc/mssql/features/default.asp">i-net software</a>. </li><li>Feature matrix as in <a href="http://www.inetsoftware.de/products/jdbc/mssql/features/default.asp">i-net software</a>.
</li><li>Updatable result set on table without primary key or unique index. </li><li>Updatable result set on table without primary key or unique index.
</li><li>Compatibility with Derby and PostgreSQL: VALUES(1), (2); SELECT * FROM (VALUES (1), (2)) AS myTable(c1). Issue 221. </li><li>Compatibility with Derby and PostgreSQL: VALUES(1), (2); SELECT * FROM (VALUES (1), (2)) AS myTable(c1). Issue 221.
...@@ -240,7 +241,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>. ...@@ -240,7 +241,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Issue 146: Support merge join. </li><li>Issue 146: Support merge join.
</li><li>Integrate spatial functions from http://geosysin.iict.ch/irstv-trac/wiki/H2spatial/Download </li><li>Integrate spatial functions from http://geosysin.iict.ch/irstv-trac/wiki/H2spatial/Download
</li><li>Cluster: hot deploy (adding a node at runtime) </li><li>Cluster: hot deploy (adding a node at runtime)
</li><li>Compact databases without having to close the database (vacuum).
</li><li>Support COSH, SINH, and TANH functions </li><li>Support COSH, SINH, and TANH functions
</li><li>Oracle: support DECODE method (convert to CASE WHEN). </li><li>Oracle: support DECODE method (convert to CASE WHEN).
</li><li>Native search: support "phrase search", wildcard search (* and ?), case-insensitive search, boolean operators, and grouping </li><li>Native search: support "phrase search", wildcard search (* and ?), case-insensitive search, boolean operators, and grouping
...@@ -515,6 +515,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>. ...@@ -515,6 +515,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Common Table Expression (CTE): avoid endless loop. Issue 218. </li><li>Common Table Expression (CTE): avoid endless loop. Issue 218.
</li><li>Common Table Expression (CTE): support multiple named queries. Issue 220. </li><li>Common Table Expression (CTE): support multiple named queries. Issue 220.
</li><li>Common Table Expression (CTE): identifier scope may be incorrect. Issue 222. </li><li>Common Table Expression (CTE): identifier scope may be incorrect. Issue 222.
</li><li>If a database object was not found in the current schema, but one with the same name existed in another schema, included that in the error message.
</li></ul> </li></ul>
<h2>Not Planned</h2> <h2>Not Planned</h2>
......
...@@ -4047,6 +4047,9 @@ public class Parser { ...@@ -4047,6 +4047,9 @@ public class Parser {
} catch (DbException e) { } catch (DbException e) {
if (force) { if (force) {
command.setSelectSQL(select); command.setSelectSQL(select);
while (currentTokenType != END) {
read();
}
} else { } else {
throw e; throw e;
} }
......
...@@ -40,6 +40,7 @@ public class TestViewDropView extends TestBase { ...@@ -40,6 +40,7 @@ public class TestViewDropView extends TestBase {
testDropViewDefaultBehaviour(); testDropViewDefaultBehaviour();
testDropViewRestrict(); testDropViewRestrict();
testDropViewCascade(); testDropViewCascade();
testCreateForceView();
testCreateOrReplaceView(); testCreateOrReplaceView();
testCreateOrReplaceViewWithNowInvalidDependentViews(); testCreateOrReplaceViewWithNowInvalidDependentViews();
testCreateOrReplaceForceViewWithNowInvalidDependentViews(); testCreateOrReplaceForceViewWithNowInvalidDependentViews();
...@@ -48,6 +49,19 @@ public class TestViewDropView extends TestBase { ...@@ -48,6 +49,19 @@ public class TestViewDropView extends TestBase {
deleteDb("alter"); deleteDb("alter");
} }
private void testCreateForceView() throws SQLException {
stat.execute("create force view test_view as select * from test");
stat.execute("create table test(id int)");
stat.execute("alter view test_view recompile");
stat.execute("select * from test_view");
stat.execute("drop table test_view, test");
stat.execute("create force view test_view as select * from test where 1=0");
stat.execute("create table test(id int)");
stat.execute("alter view test_view recompile");
stat.execute("select * from test_view");
stat.execute("drop table test_view, test");
}
private void testDropViewDefaultBehaviour() throws SQLException { private void testDropViewDefaultBehaviour() throws SQLException {
createTestData(); createTestData();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论