Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8c639ee4
提交
8c639ee4
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Throw COLUMN_IS_REFERENCED_1 instead of VIEW_IS_INVALID_2 from DROP COLUMN
上级
8f3a8e36
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
26 行增加
和
2 行删除
+26
-2
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
AlterTableAlterColumn.java
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
+6
-2
alterTableDropColumn.sql
h2/src/test/org/h2/test/scripts/ddl/alterTableDropColumn.sql
+18
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
8c639ee4
...
@@ -21,6 +21,8 @@ Change Log
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul>
<ul>
<li>
Issue #1475: Dropping column used by a view produces misleading error message
</li>
<li>
Issue #1473: TestScript needs better detection of sorted result
<li>
Issue #1473: TestScript needs better detection of sorted result
</li>
</li>
<li>
PR #1471: issue 1350: TestCrashAPI: PageStore.freeListPagesPerList
<li>
PR #1471: issue 1350: TestCrashAPI: PageStore.freeListPagesPerList
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
浏览文件 @
8c639ee4
...
@@ -297,7 +297,7 @@ public class AlterTableAlterColumn extends CommandWithColumns {
...
@@ -297,7 +297,7 @@ public class AlterTableAlterColumn extends CommandWithColumns {
checkViews
(
table
,
newTable
);
checkViews
(
table
,
newTable
);
}
catch
(
DbException
e
)
{
}
catch
(
DbException
e
)
{
execute
(
"DROP TABLE "
+
newTable
.
getName
(),
true
);
execute
(
"DROP TABLE "
+
newTable
.
getName
(),
true
);
throw
DbException
.
get
(
ErrorCode
.
VIEW_IS_INVALID_2
,
e
,
getSQL
(),
e
.
getMessage
())
;
throw
e
;
}
}
String
tableName
=
table
.
getName
();
String
tableName
=
table
.
getName
();
ArrayList
<
TableView
>
dependentViews
=
new
ArrayList
<>(
table
.
getDependentViews
());
ArrayList
<
TableView
>
dependentViews
=
new
ArrayList
<>(
table
.
getDependentViews
());
...
@@ -547,7 +547,11 @@ public class AlterTableAlterColumn extends CommandWithColumns {
...
@@ -547,7 +547,11 @@ public class AlterTableAlterColumn extends CommandWithColumns {
// check if the query is still valid
// check if the query is still valid
// do not execute, not even with limit 1, because that could
// do not execute, not even with limit 1, because that could
// have side effects or take a very long time
// have side effects or take a very long time
session
.
prepare
(
sql
);
try
{
session
.
prepare
(
sql
);
}
catch
(
DbException
e
)
{
throw
DbException
.
get
(
ErrorCode
.
COLUMN_IS_REFERENCED_1
,
e
,
view
.
getSQL
());
}
checkViewsAreValid
(
view
);
checkViewsAreValid
(
view
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/scripts/ddl/alterTableDropColumn.sql
浏览文件 @
8c639ee4
...
@@ -78,3 +78,21 @@ SELECT * FROM TEST;
...
@@ -78,3 +78,21 @@ SELECT * FROM TEST;
DROP
TABLE
TEST
;
DROP
TABLE
TEST
;
>
ok
>
ok
CREATE
TABLE
T1
(
ID
INT
PRIMARY
KEY
,
C
INT
);
>
ok
CREATE
VIEW
V1
AS
SELECT
C
FROM
T1
;
>
ok
ALTER
TABLE
T1
DROP
COLUMN
C
;
>
exception
COLUMN_IS_REFERENCED_1
DROP
VIEW
V1
;
>
ok
ALTER
TABLE
T1
DROP
COLUMN
C
;
>
ok
DROP
TABLE
T1
;
>
ok
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论