1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Rule names are now unique per-relation, rather than unique globally.

DROP RULE and COMMENT ON RULE syntax adds an 'ON tablename' clause,
similar to TRIGGER syntaxes.  To allow loading of existing pg_dump
files containing COMMENT ON RULE, the COMMENT code will still accept
the old syntax --- but only if the target rulename is unique across
the whole database.
This commit is contained in:
Tom Lane
2002-04-18 20:01:11 +00:00
parent 4e08a625b0
commit b3120804ad
35 changed files with 489 additions and 300 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.94 2002/03/22 19:20:09 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.95 2002/04/18 20:01:08 tgl Exp $
PostgreSQL documentation
-->
@ -4344,7 +4344,12 @@ SELECT NULLIF(value, '(none)') ...
<entry>Get CREATE VIEW command for view</>
</row>
<row>
<entry><function>pg_get_ruledef</>(<parameter>rulename</parameter>)</entry>
<entry><function>pg_get_viewdef</>(<parameter>viewOID</parameter>)</entry>
<entry><type>text</></entry>
<entry>Get CREATE VIEW command for view</>
</row>
<row>
<entry><function>pg_get_ruledef</>(<parameter>ruleOID</parameter>)</entry>
<entry><type>text</></entry>
<entry>Get CREATE RULE command for rule</>
</row>

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.15 2002/03/19 02:18:12 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.16 2002/04/18 20:01:09 tgl Exp $
PostgreSQL documentation
-->
@ -25,11 +25,12 @@ PostgreSQL documentation
<synopsis>
COMMENT ON
[
[ DATABASE | DOMAIN | INDEX | RULE | SEQUENCE | TABLE | TYPE | VIEW ] <replaceable class="PARAMETER">object_name</replaceable> |
[ DATABASE | DOMAIN | INDEX | SEQUENCE | TABLE | TYPE | VIEW ] <replaceable class="PARAMETER">object_name</replaceable> |
COLUMN <replaceable class="PARAMETER">table_name</replaceable>.<replaceable class="PARAMETER">column_name</replaceable> |
AGGREGATE <replaceable class="PARAMETER">agg_name</replaceable> (<replaceable class="PARAMETER">agg_type</replaceable>) |
FUNCTION <replaceable class="PARAMETER">func_name</replaceable> (<replaceable class="PARAMETER">arg1</replaceable>, <replaceable class="PARAMETER">arg2</replaceable>, ...) |
OPERATOR <replaceable class="PARAMETER">op</replaceable> (<replaceable class="PARAMETER">leftoperand_type</replaceable> <replaceable class="PARAMETER">rightoperand_type</replaceable>) |
RULE <replaceable class="PARAMETER">rule_name</replaceable> ON <replaceable class="PARAMETER">table_name</replaceable> |
TRIGGER <replaceable class="PARAMETER">trigger_name</replaceable> ON <replaceable class="PARAMETER">table_name</replaceable>
] IS <replaceable class="PARAMETER">'text'</replaceable>
</synopsis>
@ -46,7 +47,7 @@ COMMENT ON
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">object_name, table_name,
column_name, agg_name, func_name, op, trigger_name</replaceable></term>
column_name, agg_name, func_name, op, rule_name, trigger_name</replaceable></term>
<listitem>
<para>
The name of the object to be be commented.
@ -143,7 +144,6 @@ COMMENT ON mytable IS 'This is my table.';
COMMENT ON DATABASE my_database IS 'Development Database';
COMMENT ON DOMAIN my_domain IS 'Email Address Domain';
COMMENT ON INDEX my_index IS 'Enforces uniqueness on employee id';
COMMENT ON RULE my_rule IS 'Logs UPDATES of employee records';
COMMENT ON SEQUENCE my_sequence IS 'Used to generate primary keys';
COMMENT ON TABLE my_table IS 'Employee Information';
COMMENT ON TYPE my_type IS 'Complex Number support';
@ -152,6 +152,7 @@ COMMENT ON COLUMN my_table.my_field IS 'Employee ID number';
COMMENT ON AGGREGATE my_aggregate (double precision) IS 'Computes sample variance';
COMMENT ON FUNCTION my_function (timestamp) IS 'Returns Roman Numeral';
COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two text';
COMMENT ON RULE my_rule ON my_table IS 'Logs UPDATES of employee records';
COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for R.I.';
</programlisting>
</para>

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_rule.sgml,v 1.11 2001/12/08 03:24:36 thomas Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_rule.sgml,v 1.12 2002/04/18 20:01:09 tgl Exp $
PostgreSQL documentation
-->
@ -23,7 +23,7 @@ PostgreSQL documentation
<date>1998-09-22</date>
</refsynopsisdivinfo>
<synopsis>
DROP RULE <replaceable class="PARAMETER">name</replaceable> [, ...]
DROP RULE <replaceable class="PARAMETER">name</replaceable> ON <replaceable class="PARAMETER">relation</replaceable>
</synopsis>
<refsect2 id="R2-SQL-DROPRULE-1">
@ -43,6 +43,14 @@ DROP RULE <replaceable class="PARAMETER">name</replaceable> [, ...]
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">relation</replaceable></term>
<listitem>
<para>
The name of the relation the rule applies to.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
@ -68,7 +76,7 @@ DROP
</varlistentry>
<varlistentry>
<term><computeroutput>
ERROR: Rule or view "<replaceable class="parameter">name</replaceable>" not found
ERROR: Rule "<replaceable class="parameter">name</replaceable>" not found
</computeroutput></term>
<listitem>
<para>
@ -113,11 +121,6 @@ ERROR: Rule or view "<replaceable class="parameter">name</replaceable>" not fou
Refer to <command>CREATE RULE</command> for
information on how to create rules.
</para>
<para>
Once a rule is dropped, access to historical information
the rule has written may disappear.
</para>
</refsect2>
</refsect1>
@ -129,7 +132,7 @@ ERROR: Rule or view "<replaceable class="parameter">name</replaceable>" not fou
To drop the rewrite rule <literal>newrule</literal>:
<programlisting>
DROP RULE newrule;
DROP RULE newrule ON mytable;
</programlisting>
</para>
</refsect1>

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.132 2002/04/10 22:46:48 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.133 2002/04/18 20:01:08 tgl Exp $
-->
<appendix id="release">
@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
worries about funny characters.
-->
<literallayout><![CDATA[
Rule names are now per-relation, not global; DROP RULE and COMMENT ON RULE syntax changes accordingly
Readline and Zlib are now required by default and must be turned off explicitly if their use is not desired
Define a third class of function volatility to allow indexscans in more cases
Locale support is now built by default; choice of locale is set by initdb and/or at run-time