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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-02-05 18:13:52 UTC
  • mfrom: (1.1.10) (10.1.5 oneiric-proposed)
  • Revision ID: package-import@ubuntu.com-20130205181352-3kw4f94ilqklzm7c
Tags: 9.1.8-0ubuntu11.10
* New upstream security/bug fix release: (LP: #1116336)
  - Prevent execution of enum_recv from SQL
    The function was misdeclared, allowing a simple SQL command to crash the
    server.  In principle an attacker might be able to use it to examine the
    contents of server memory.  Our thanks to Sumit Soni (via Secunia SVCRP)
    for reporting this issue. (CVE-2013-0255)
  - See HISTORY/changelog.gz for the other bug fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
REV="MADE"
10
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
11
11
REL="HOME"
12
 
TITLE="PostgreSQL 9.1.5 Documentation"
 
12
TITLE="PostgreSQL 9.1.8 Documentation"
13
13
HREF="index.html"><LINK
14
14
REL="UP"
15
15
TITLE="Interface Functions"
26
26
HTTP-EQUIV="Content-Type"
27
27
CONTENT="text/html; charset=ISO-8859-1"><META
28
28
NAME="creation"
29
 
CONTENT="2012-08-14T22:55:48"></HEAD
 
29
CONTENT="2013-02-04T21:38:53"></HEAD
30
30
><BODY
31
31
CLASS="REFENTRY"
32
32
><DIV
44
44
VALIGN="bottom"
45
45
><A
46
46
HREF="index.html"
47
 
>PostgreSQL 9.1.5 Documentation</A
 
47
>PostgreSQL 9.1.8 Documentation</A
48
48
></TH
49
49
></TR
50
50
><TR
95
95
><DIV
96
96
CLASS="REFNAMEDIV"
97
97
><A
98
 
NAME="AEN57251"
 
98
NAME="AEN57279"
99
99
></A
100
100
><H2
101
101
>Name</H2
103
103
><DIV
104
104
CLASS="REFSYNOPSISDIV"
105
105
><A
106
 
NAME="AEN57256"
 
106
NAME="AEN57284"
107
107
></A
108
108
><H2
109
109
>Synopsis</H2
123
123
><DIV
124
124
CLASS="REFSECT1"
125
125
><A
126
 
NAME="AEN57261"
 
126
NAME="AEN57289"
127
127
></A
128
128
><H2
129
129
>Description</H2
157
157
CLASS="PARAMETER"
158
158
>count</TT
159
159
>
160
 
   is greater than 0, then the number of rows for which the command
161
 
   will be executed is restricted (much like a
162
 
   <TT
 
160
   is greater than zero, then no more than <TT
 
161
CLASS="PARAMETER"
 
162
>count</TT
 
163
> rows
 
164
   will be retrieved; execution stops when the count is reached, much like
 
165
   adding a <TT
163
166
CLASS="LITERAL"
164
167
>LIMIT</TT
165
 
> clause). For example:
 
168
> clause to the query. For example,
 
169
</P><PRE
 
170
CLASS="PROGRAMLISTING"
 
171
>SPI_execute("SELECT * FROM foo", true, 5);</PRE
 
172
><P>
 
173
   will retrieve at most 5 rows from the table.  Note that such a limit
 
174
   is only effective when the command actually returns rows.  For example,
166
175
</P><PRE
167
176
CLASS="PROGRAMLISTING"
168
177
>SPI_execute("INSERT INTO foo SELECT * FROM bar", false, 5);</PRE
169
178
><P>
170
 
   will allow at most 5 rows to be inserted into the table.
 
179
   inserts all rows from <TT
 
180
CLASS="STRUCTNAME"
 
181
>bar</TT
 
182
>, ignoring the
 
183
   <TT
 
184
CLASS="PARAMETER"
 
185
>count</TT
 
186
> parameter.  However, with
 
187
</P><PRE
 
188
CLASS="PROGRAMLISTING"
 
189
>SPI_execute("INSERT INTO foo SELECT * FROM bar RETURNING *", false, 5);</PRE
 
190
><P>
 
191
   at most 5 rows would be inserted, since execution would stop after the
 
192
   fifth <TT
 
193
CLASS="LITERAL"
 
194
>RETURNING</TT
 
195
> result row is retrieved.
171
196
  </P
172
197
><P
173
198
>   You can pass multiple commands in one string, but later commands cannot
181
206
CLASS="PARAMETER"
182
207
>count</TT
183
208
>
184
 
   limit applies to each command separately, but it is not applied to
 
209
   limit applies to each command separately (even though only the last
 
210
   result will actually be returned).  The limit is not applied to any
185
211
   hidden commands generated by rules.
186
212
  </P
187
213
><P
345
371
><DIV
346
372
CLASS="REFSECT1"
347
373
><A
348
 
NAME="AEN57314"
 
374
NAME="AEN57348"
349
375
></A
350
376
><H2
351
377
>Arguments</H2
392
418
></DT
393
419
><DD
394
420
><P
395
 
>      maximum number of rows to process or return
 
421
>      maximum number of rows to return,
 
422
      or <TT
 
423
CLASS="LITERAL"
 
424
>0</TT
 
425
> for no limit
396
426
     </P
397
427
></DD
398
428
></DL
401
431
><DIV
402
432
CLASS="REFSECT1"
403
433
><A
404
 
NAME="AEN57336"
 
434
NAME="AEN57371"
405
435
></A
406
436
><H2
407
437
>Return Value</H2
672
702
><DIV
673
703
CLASS="REFSECT1"
674
704
><A
675
 
NAME="AEN57442"
 
705
NAME="AEN57477"
676
706
></A
677
707
><H2
678
708
>Notes</H2
679
709
><P
680
 
>   The functions <CODE
681
 
CLASS="FUNCTION"
682
 
>SPI_execute</CODE
683
 
>,
684
 
   <CODE
685
 
CLASS="FUNCTION"
686
 
>SPI_exec</CODE
687
 
>,
688
 
   <CODE
689
 
CLASS="FUNCTION"
690
 
>SPI_execute_plan</CODE
691
 
>, and
692
 
   <CODE
693
 
CLASS="FUNCTION"
694
 
>SPI_execp</CODE
695
 
> change both
 
710
>   All SPI query-execution functions set both
696
711
   <TT
697
712
CLASS="VARNAME"
698
713
>SPI_processed</TT
706
721
   <CODE
707
722
CLASS="FUNCTION"
708
723
>SPI_execute</CODE
709
 
> or a related function
 
724
> or another query-execution function
710
725
   across later calls.
711
726
  </P
712
727
></DIV