Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
592b6905
Commit
592b6905
authored
Apr 07, 2000
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update rule examples
parent
d27a5665
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
doc/src/sgml/ref/create_rule.sgml
doc/src/sgml/ref/create_rule.sgml
+23
-13
No files found.
doc/src/sgml/ref/create_rule.sgml
View file @
592b6905
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.1
1 2000/04/07 17:23:11
momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.1
2 2000/04/07 17:35:08
momjian Exp $
Postgres documentation
-->
...
...
@@ -171,12 +171,14 @@ CREATE
two rules have the same semantics:
<programlisting>
ON UPDATE TO emp.salary WHERE emp.name = "Joe"
DO UPDATE emp ( ... ) WHERE ...
DO
UPDATE emp ( ... ) WHERE ...
</programlisting>
<programlisting>
ON UPDATE TO emp-1.salary WHERE emp-2.name = "Joe"
DO UPDATE emp-3 ( ... ) WHERE ...
DO
UPDATE emp-3 ( ... ) WHERE ...
</programlisting>
Each rule can have the optional tag INSTEAD.
...
...
@@ -203,13 +205,15 @@ ON UPDATE TO emp-1.salary WHERE emp-2.name = "Joe"
<programlisting>
CREATE RULE bad_rule_combination_1 AS
ON SELECT TO emp
DO INSTEAD SELECT TO toyemp;
DO INSTEAD
SELECT TO toyemp;
</programlisting>
<programlisting>
CREATE RULE bad_rule_combination_2 AS
ON SELECT TO toyemp
DO INSTEAD SELECT TO emp;
DO INSTEAD
SELECT TO emp;
</programlisting>
<para>
This attempt to retrieve from EMP will cause
...
...
@@ -257,7 +261,9 @@ SELECT * FROM emp;
<programlisting>
CREATE RULE example_1 AS
ON UPDATE emp.salary WHERE current.name = "Joe"
DO UPDATE emp (salary = new.salary)
DO
UPDATE emp
SET salary = new.salary
WHERE emp.name = "Sam";
</programlisting>
...
...
@@ -275,7 +281,8 @@ CREATE RULE example_2 AS
ON SELECT TO EMP.salary
WHERE current.name = "Bill"
DO INSTEAD
SELECT (emp.salary) from emp
SELECT emp.salary
FROM emp
WHERE emp.name = "Joe";
</programlisting>
</para>
...
...
@@ -285,7 +292,8 @@ CREATE RULE example_2 AS
the current user):
<programlisting>
CREATE RULE example_3 AS
ON SELECT TO emp.salary
ON
SELECT TO emp.salary
WHERE current.dept = "shoe" AND current_user = "Joe"
DO INSTEAD NOTHING;
</programlisting>
...
...
@@ -298,7 +306,8 @@ CREATE toyemp(name = char16, salary = int4);
CREATE RULE example_4 AS
ON SELECT TO toyemp
DO INSTEAD
SELECT (emp.name, emp.salary) FROM emp
SELECT (emp.name, emp.salary)
FROM emp
WHERE emp.dept = "toy";
</programlisting>
</para>
...
...
@@ -307,7 +316,8 @@ CREATE RULE example_4 AS
<programlisting>
CREATE RULE example_5 AS
ON INERT TO emp WHERE new.salary > 5000
DO UPDATE NEWSET salary = 5000;
DO
UPDATE NEWSET salary = 5000;
</programlisting>
</para>
</refsect1>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment