2 39.6. Rules and Command Status #
4 The PostgreSQL server returns a command status string, such as INSERT
5 149592 1, for each command it receives. This is simple enough when
6 there are no rules involved, but what happens when the query is
9 Rules affect the command status as follows:
10 * If there is no unconditional INSTEAD rule for the query, then the
11 originally given query will be executed, and its command status
12 will be returned as usual. (But note that if there were any
13 conditional INSTEAD rules, the negation of their qualifications
14 will have been added to the original query. This might reduce the
15 number of rows it processes, and if so the reported status will be
17 * If there is any unconditional INSTEAD rule for the query, then the
18 original query will not be executed at all. In this case, the
19 server will return the command status for the last query that was
20 inserted by an INSTEAD rule (conditional or unconditional) and is
21 of the same command type (INSERT, UPDATE, or DELETE) as the
22 original query. If no query meeting those requirements is added by
23 any rule, then the returned command status shows the original query
24 type and zeroes for the row-count and OID fields.
26 The programmer can ensure that any desired INSTEAD rule is the one that
27 sets the command status in the second case, by giving it the
28 alphabetically last rule name among the active rules, so that it gets