1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
>Visibility of Data Changes</TITLE
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
12
TITLE="PostgreSQL 9.1beta1 Documentation"
13
HREF="index.html"><LINK
15
TITLE="Server Programming Interface"
19
HREF="spi-spi-freeplan.html"><LINK
22
HREF="spi-examples.html"><LINK
25
HREF="stylesheet.css"><META
26
HTTP-EQUIV="Content-Type"
27
CONTENT="text/html; charset=ISO-8859-1"><META
29
CONTENT="2011-04-27T21:20:33"></HEAD
35
SUMMARY="Header navigation table"
47
>PostgreSQL 9.1beta1 Documentation</A
57
HREF="spi-spi-freeplan.html"
66
TITLE="Server Programming Interface"
74
>Chapter 43. Server Programming Interface</TD
80
TITLE="Server Programming Interface"
90
HREF="spi-examples.html"
104
NAME="SPI-VISIBILITY"
105
>43.4. Visibility of Data Changes</A
108
> The following rules govern the visibility of data changes in
109
functions that use SPI (or any other C function):
116
> During the execution of an SQL command, any data changes made by
117
the command are invisible to the command itself. For
120
CLASS="PROGRAMLISTING"
121
>INSERT INTO a SELECT * FROM a;</PRE
123
the inserted rows are invisible to the <TT
132
> Changes made by a command C are visible to all commands that are
133
started after C, no matter whether they are started inside C
134
(during the execution of C) or after C is done.
139
> Commands executed via SPI inside a function called by an SQL command
140
(either an ordinary function or a trigger) follow one or the
141
other of the above rules depending on the read/write flag passed
142
to SPI. Commands executed in read-only mode follow the first
143
rule: they cannot see changes of the calling command. Commands executed
144
in read-write mode follow the second rule: they can see all changes made
150
> All standard procedural languages set the SPI read-write mode
151
depending on the volatility attribute of the function. Commands of
158
> functions are done in
159
read-only mode, while commands of <TT
163
done in read-write mode. While authors of C functions are able to
164
violate this convention, it's unlikely to be a good idea to do so.
171
> The next section contains an example that illustrates the
172
application of these rules.
180
SUMMARY="Footer navigation table"
191
HREF="spi-spi-freeplan.html"
209
HREF="spi-examples.html"
b'\\ No newline at end of file'