~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/html/spi-visibility.html

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>Visibility of Data Changes</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REV="MADE"
 
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
 
11
REL="HOME"
 
12
TITLE="PostgreSQL 9.1beta1 Documentation"
 
13
HREF="index.html"><LINK
 
14
REL="UP"
 
15
TITLE="Server Programming Interface"
 
16
HREF="spi.html"><LINK
 
17
REL="PREVIOUS"
 
18
TITLE="SPI_freeplan"
 
19
HREF="spi-spi-freeplan.html"><LINK
 
20
REL="NEXT"
 
21
TITLE="Examples"
 
22
HREF="spi-examples.html"><LINK
 
23
REL="STYLESHEET"
 
24
TYPE="text/css"
 
25
HREF="stylesheet.css"><META
 
26
HTTP-EQUIV="Content-Type"
 
27
CONTENT="text/html; charset=ISO-8859-1"><META
 
28
NAME="creation"
 
29
CONTENT="2011-04-27T21:20:33"></HEAD
 
30
><BODY
 
31
CLASS="SECT1"
 
32
><DIV
 
33
CLASS="NAVHEADER"
 
34
><TABLE
 
35
SUMMARY="Header navigation table"
 
36
WIDTH="100%"
 
37
BORDER="0"
 
38
CELLPADDING="0"
 
39
CELLSPACING="0"
 
40
><TR
 
41
><TH
 
42
COLSPAN="5"
 
43
ALIGN="center"
 
44
VALIGN="bottom"
 
45
><A
 
46
HREF="index.html"
 
47
>PostgreSQL 9.1beta1 Documentation</A
 
48
></TH
 
49
></TR
 
50
><TR
 
51
><TD
 
52
WIDTH="10%"
 
53
ALIGN="left"
 
54
VALIGN="top"
 
55
><A
 
56
TITLE="SPI_freeplan"
 
57
HREF="spi-spi-freeplan.html"
 
58
ACCESSKEY="P"
 
59
>Prev</A
 
60
></TD
 
61
><TD
 
62
WIDTH="10%"
 
63
ALIGN="left"
 
64
VALIGN="top"
 
65
><A
 
66
TITLE="Server Programming Interface"
 
67
HREF="spi.html"
 
68
>Fast Backward</A
 
69
></TD
 
70
><TD
 
71
WIDTH="60%"
 
72
ALIGN="center"
 
73
VALIGN="bottom"
 
74
>Chapter 43. Server Programming Interface</TD
 
75
><TD
 
76
WIDTH="10%"
 
77
ALIGN="right"
 
78
VALIGN="top"
 
79
><A
 
80
TITLE="Server Programming Interface"
 
81
HREF="spi.html"
 
82
>Fast Forward</A
 
83
></TD
 
84
><TD
 
85
WIDTH="10%"
 
86
ALIGN="right"
 
87
VALIGN="top"
 
88
><A
 
89
TITLE="Examples"
 
90
HREF="spi-examples.html"
 
91
ACCESSKEY="N"
 
92
>Next</A
 
93
></TD
 
94
></TR
 
95
></TABLE
 
96
><HR
 
97
ALIGN="LEFT"
 
98
WIDTH="100%"></DIV
 
99
><DIV
 
100
CLASS="SECT1"
 
101
><H1
 
102
CLASS="SECT1"
 
103
><A
 
104
NAME="SPI-VISIBILITY"
 
105
>43.4. Visibility of Data Changes</A
 
106
></H1
 
107
><P
 
108
>   The following rules govern the visibility of data changes in
 
109
   functions that use SPI (or any other C function):
 
110
 
 
111
   <P
 
112
></P
 
113
></P><UL
 
114
><LI
 
115
><P
 
116
>      During the execution of an SQL command, any data changes made by
 
117
      the command are invisible to the command itself.  For
 
118
      example, in:
 
119
</P><PRE
 
120
CLASS="PROGRAMLISTING"
 
121
>INSERT INTO a SELECT * FROM a;</PRE
 
122
><P>
 
123
      the inserted rows are invisible to the <TT
 
124
CLASS="COMMAND"
 
125
>SELECT</TT
 
126
>
 
127
      part.
 
128
     </P
 
129
></LI
 
130
><LI
 
131
><P
 
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.
 
135
     </P
 
136
></LI
 
137
><LI
 
138
><P
 
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
 
145
      so far.
 
146
     </P
 
147
></LI
 
148
><LI
 
149
><P
 
150
>      All standard procedural languages set the SPI read-write mode
 
151
      depending on the volatility attribute of the function.  Commands of
 
152
      <TT
 
153
CLASS="LITERAL"
 
154
>STABLE</TT
 
155
> and <TT
 
156
CLASS="LITERAL"
 
157
>IMMUTABLE</TT
 
158
> functions are done in
 
159
      read-only mode, while commands of <TT
 
160
CLASS="LITERAL"
 
161
>VOLATILE</TT
 
162
> functions are
 
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.
 
165
     </P
 
166
></LI
 
167
></UL
 
168
><P>
 
169
  </P
 
170
><P
 
171
>   The next section contains an example that illustrates the
 
172
   application of these rules.
 
173
  </P
 
174
></DIV
 
175
><DIV
 
176
CLASS="NAVFOOTER"
 
177
><HR
 
178
ALIGN="LEFT"
 
179
WIDTH="100%"><TABLE
 
180
SUMMARY="Footer navigation table"
 
181
WIDTH="100%"
 
182
BORDER="0"
 
183
CELLPADDING="0"
 
184
CELLSPACING="0"
 
185
><TR
 
186
><TD
 
187
WIDTH="33%"
 
188
ALIGN="left"
 
189
VALIGN="top"
 
190
><A
 
191
HREF="spi-spi-freeplan.html"
 
192
ACCESSKEY="P"
 
193
>Prev</A
 
194
></TD
 
195
><TD
 
196
WIDTH="34%"
 
197
ALIGN="center"
 
198
VALIGN="top"
 
199
><A
 
200
HREF="index.html"
 
201
ACCESSKEY="H"
 
202
>Home</A
 
203
></TD
 
204
><TD
 
205
WIDTH="33%"
 
206
ALIGN="right"
 
207
VALIGN="top"
 
208
><A
 
209
HREF="spi-examples.html"
 
210
ACCESSKEY="N"
 
211
>Next</A
 
212
></TD
 
213
></TR
 
214
><TR
 
215
><TD
 
216
WIDTH="33%"
 
217
ALIGN="left"
 
218
VALIGN="top"
 
219
>SPI_freeplan</TD
 
220
><TD
 
221
WIDTH="34%"
 
222
ALIGN="center"
 
223
VALIGN="top"
 
224
><A
 
225
HREF="spi.html"
 
226
ACCESSKEY="U"
 
227
>Up</A
 
228
></TD
 
229
><TD
 
230
WIDTH="33%"
 
231
ALIGN="right"
 
232
VALIGN="top"
 
233
>Examples</TD
 
234
></TR
 
235
></TABLE
 
236
></DIV
 
237
></BODY
 
238
></HTML
 
239
>
 
 
b'\\ No newline at end of file'