Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
4a3bf197
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4a3bf197
编写于
11月 06, 2001
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add some notes about conditional rules used with views.
上级
f688c1e0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
47 addition
and
9 deletion
+47
-9
doc/src/sgml/ref/create_rule.sgml
doc/src/sgml/ref/create_rule.sgml
+40
-6
doc/src/sgml/ref/create_view.sgml
doc/src/sgml/ref/create_view.sgml
+7
-3
未找到文件。
doc/src/sgml/ref/create_rule.sgml
浏览文件 @
4a3bf197
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.2
8 2001/10/09 18:46:00 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.2
9 2001/11/06 23:54:32 tgl
Exp $
Postgres documentation
-->
...
...
@@ -196,10 +196,10 @@ CREATE
<refsect2 id="R2-SQL-CREATERULE-3">
<refsect2info>
<date>2001-
01-05
</date>
<date>2001-
11-06
</date>
</refsect2info>
<title>
Note
s
Rules and View
s
</title>
<para>
Presently, ON SELECT rules must be unconditional INSTEAD rules and must
...
...
@@ -207,10 +207,44 @@ CREATE
rule effectively turns the object table into a view, whose visible
contents are the rows returned by the rule's SELECT query rather than
whatever had been stored in the table (if anything). It is considered
better style to write a CREATE VIEW command than to create a table and
define an ON SELECT rule for it.
better style to write a CREATE VIEW command than to create a real table
and define an ON SELECT rule for it.
</para>
<para>
<xref linkend="sql-createview"> creates a dummy table (with no underlying
storage) and associates an ON SELECT rule with it. The system will not
allow updates to the view, since it knows there is no real table there.
You can create the
illusion of an updatable view by defining ON INSERT, ON UPDATE, and
ON DELETE rules (or any subset of those that's sufficient
for your purposes) to replace update actions on the view with
appropriate updates on other tables.
</para>
<para>
There is a catch if you try to use conditional
rules for view updates: there <emphasis>must</> be an unconditional
INSTEAD rule for each action you wish to allow on the view. If the
rule is conditional, or is not INSTEAD, then the system will still reject
attempts to perform the update action, because it thinks it might end up
trying to perform the action on the dummy table in some cases.
If you want to
handle all the useful cases in conditional rules, you can; just add an
unconditional DO INSTEAD NOTHING rule to ensure that the system
understands it will never be called on to update the dummy table. Then
make the conditional rules non-INSTEAD; in the cases where they fire,
they add to the default INSTEAD NOTHING action.
</para>
</refsect2>
<refsect2 id="R2-SQL-CREATERULE-4">
<refsect2info>
<date>2001-01-05</date>
</refsect2info>
<title>
Notes
</title>
<para>
You must have rule definition access to a table in order
to define a rule on it. Use <command>GRANT</command>
...
...
@@ -267,7 +301,7 @@ UPDATE mytable SET name = 'foo' WHERE id = 42;
Compatibility
</title>
<refsect2 id="R2-SQL-CREATERULE-
4
">
<refsect2 id="R2-SQL-CREATERULE-
5
">
<refsect2info>
<date>1998-09-11</date>
</refsect2info>
...
...
doc/src/sgml/ref/create_view.sgml
浏览文件 @
4a3bf197
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_view.sgml,v 1.1
2 2001/09/03 12:57:49 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_view.sgml,v 1.1
3 2001/11/06 23:54:32 tgl
Exp $
Postgres documentation
-->
...
...
@@ -102,7 +102,7 @@ ERROR: Relation '<replaceable class="parameter">view</replaceable>' already exi
</varlistentry>
<varlistentry>
<term><computeroutput>
NOTICE
create: attribute named "<replaceable class="parameter">column</replaceable>"
has an unknown type
NOTICE
: Attribute '<replaceable class="parameter">column</replaceable>'
has an unknown type
</computeroutput></term>
<listitem>
<para>
...
...
@@ -149,7 +149,11 @@ CREATE VIEW vista AS SELECT text 'Hello World'
</title>
<para>
Currently, views are read only.
Currently, views are read only: the system will not allow an insert,
update, or delete on a view. You can get the effect of an updatable
view by creating rules that rewrite inserts, etc. on the view into
appropriate actions on other tables. For more information see
<xref linkend="sql-createrule">.
</para>
<para>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录