Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit bf82365

Browse files
committed
Remove the prohibition on executing cursor commands through SPI_execute.
Vadim had included this restriction in the original design of the SPI code, but I'm darned if I can see a reason for it. I left the macro definition of SPI_ERROR_CURSOR in place, so as not to needlessly break any SPI callers that are checking for it, but that code will never actually be returned anymore.
1 parent e85a01d commit bf82365

File tree

4 files changed

+6
-35
lines changed

4 files changed

+6
-35
lines changed

doc/src/sgml/spi.sgml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.54 2007/03/15 23:12:06 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/spi.sgml,v 1.55 2007/03/25 23:27:59 tgl Exp $ -->
22

33
<chapter id="spi">
44
<title>Server Programming Interface</title>
@@ -554,21 +554,11 @@ typedef struct
554554
</listitem>
555555
</varlistentry>
556556

557-
<varlistentry>
558-
<term><symbol>SPI_ERROR_CURSOR</symbol></term>
559-
<listitem>
560-
<para>
561-
if <command>DECLARE</>, <command>CLOSE</>, or <command>FETCH</>
562-
was attempted
563-
</para>
564-
</listitem>
565-
</varlistentry>
566-
567557
<varlistentry>
568558
<term><symbol>SPI_ERROR_TRANSACTION</symbol></term>
569559
<listitem>
570560
<para>
571-
if any command involving transaction manipulation was attempted
561+
if a transaction manipulation command was attempted
572562
(<command>BEGIN</>,
573563
<command>COMMIT</>,
574564
<command>ROLLBACK</>,

src/backend/executor/spi.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.173 2007/03/17 03:15:38 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.174 2007/03/25 23:27:59 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1155,8 +1155,6 @@ SPI_result_code_string(int code)
11551155
return "SPI_ERROR_OPUNKNOWN";
11561156
case SPI_ERROR_UNCONNECTED:
11571157
return "SPI_ERROR_UNCONNECTED";
1158-
case SPI_ERROR_CURSOR:
1159-
return "SPI_ERROR_CURSOR";
11601158
case SPI_ERROR_ARGUMENT:
11611159
return "SPI_ERROR_ARGUMENT";
11621160
case SPI_ERROR_PARAM:
@@ -1490,13 +1488,6 @@ _SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls,
14901488
goto fail;
14911489
}
14921490
}
1493-
else if (IsA(stmt, DeclareCursorStmt) ||
1494-
IsA(stmt, ClosePortalStmt) ||
1495-
IsA(stmt, FetchStmt))
1496-
{
1497-
my_res = SPI_ERROR_CURSOR;
1498-
goto fail;
1499-
}
15001491
else if (IsA(stmt, TransactionStmt))
15011492
{
15021493
my_res = SPI_ERROR_TRANSACTION;

src/include/executor/spi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.59 2007/03/15 23:12:06 tgl Exp $
9+
* $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.60 2007/03/25 23:27:59 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -61,7 +61,7 @@ typedef struct _SPI_plan *SPIPlanPtr;
6161
#define SPI_ERROR_COPY (-2)
6262
#define SPI_ERROR_OPUNKNOWN (-3)
6363
#define SPI_ERROR_UNCONNECTED (-4)
64-
#define SPI_ERROR_CURSOR (-5)
64+
#define SPI_ERROR_CURSOR (-5) /* not used anymore */
6565
#define SPI_ERROR_ARGUMENT (-6)
6666
#define SPI_ERROR_PARAM (-7)
6767
#define SPI_ERROR_TRANSACTION (-8)

src/pl/plpgsql/src/pl_exec.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.190 2007/03/15 23:12:07 tgl Exp $
11+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.191 2007/03/25 23:27:59 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2327,11 +2327,6 @@ exec_prepare_plan(PLpgSQL_execstate *estate,
23272327
ereport(ERROR,
23282328
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
23292329
errmsg("cannot COPY to/from client in PL/pgSQL")));
2330-
case SPI_ERROR_CURSOR:
2331-
ereport(ERROR,
2332-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2333-
errmsg("cannot manipulate cursors directly in PL/pgSQL"),
2334-
errhint("Use PL/pgSQL's cursor features instead.")));
23352330
case SPI_ERROR_TRANSACTION:
23362331
ereport(ERROR,
23372332
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -2631,11 +2626,6 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
26312626
ereport(ERROR,
26322627
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
26332628
errmsg("cannot COPY to/from client in PL/pgSQL")));
2634-
case SPI_ERROR_CURSOR:
2635-
ereport(ERROR,
2636-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2637-
errmsg("cannot manipulate cursors directly in PL/pgSQL"),
2638-
errhint("Use PL/pgSQL's cursor features instead.")));
26392629
case SPI_ERROR_TRANSACTION:
26402630
ereport(ERROR,
26412631
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),

0 commit comments

Comments
 (0)