Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit693aad4

Browse files
committed
Change warnings for non-existing or pre-existing cursors to errors.
1 parentc3664c0 commit693aad4

File tree

6 files changed

+21
-27
lines changed

6 files changed

+21
-27
lines changed

‎doc/src/sgml/ref/close.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/close.sgml,v 1.15 2003/08/17 04:46:00 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/close.sgml,v 1.16 2003/08/24 21:02:42 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -70,10 +70,10 @@ CLOSE <replaceable class="PARAMETER">cursor</replaceable>
7070
</varlistentry>
7171

7272
<varlistentry>
73-
<term><computeroutput>WARNING:PerformPortalClose: portal"<replaceable class="PARAMETER">cursor</replaceable>" notfound</computeroutput></term>
73+
<term><computeroutput>ERROR:cursor"<replaceable class="PARAMETER">cursor</replaceable>"doesnotexist</computeroutput></term>
7474
<listitem>
7575
<para>
76-
This warning is given if <replaceable
76+
Message returned if <replaceable
7777
class="PARAMETER">cursor</replaceable> is not declared or has
7878
already been closed.
7979
</para>

‎doc/src/sgml/ref/declare.sgml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/declare.sgml,v 1.24 2003/05/0402:23:16 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/declare.sgml,v 1.25 2003/08/24 21:02:42 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -202,11 +202,10 @@ DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INS
202202
</varlistentry>
203203

204204
<varlistentry>
205-
<term><computeroutput>WARNING:Closing pre-existing portal"<replaceable class="parameter">cursorname</replaceable>"</computeroutput></term>
205+
<term><computeroutput>ERROR:cursor"<replaceable class="parameter">cursorname</replaceable>" already exists</computeroutput></term>
206206
<listitem>
207207
<para>
208-
This message is reported if a cursor with the same name already
209-
exists. The previous definition is discarded.
208+
This error occurs if a cursor with the same name already exists.
210209
</para>
211210
</listitem>
212211
</varlistentry>

‎doc/src/sgml/ref/fetch.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/fetch.sgml,v 1.29 2003/05/0402:23:16 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/fetch.sgml,v 1.30 2003/08/24 21:02:43 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -281,7 +281,7 @@ where <replaceable class="PARAMETER">direction</replaceable> can be empty or one
281281

282282
<variablelist>
283283
<varlistentry>
284-
<term><computeroutput>WARNING:PerformPortalFetch: portal"<replaceable class="PARAMETER">cursor</replaceable>" notfound</computeroutput></term>
284+
<term><computeroutput>ERROR:cursor"<replaceable class="PARAMETER">cursor</replaceable>"doesnotexist</computeroutput></term>
285285
<listitem>
286286
<para>
287287
There is no cursor with the specified name.

‎src/backend/commands/portalcmds.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.23 2003/08/08 21:41:32 momjian Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.24 2003/08/24 21:02:43 petere Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -88,10 +88,9 @@ PerformCursorOpen(DeclareCursorStmt *stmt)
8888

8989
/*
9090
* Create a portal and copy the query and plan into its memory
91-
* context. (If a duplicate cursor name already exists, warn and drop
92-
* it.)
91+
* context.
9392
*/
94-
portal=CreatePortal(stmt->portalname,true, false);
93+
portal=CreatePortal(stmt->portalname,false, false);
9594

9695
oldContext=MemoryContextSwitchTo(PortalGetHeapMemory(portal));
9796

@@ -168,13 +167,10 @@ PerformPortalFetch(FetchStmt *stmt,
168167
portal=GetPortalByName(stmt->portalname);
169168
if (!PortalIsValid(portal))
170169
{
171-
/* FIXME: shouldn't this be an ERROR? */
172-
ereport(WARNING,
170+
ereport(ERROR,
173171
(errcode(ERRCODE_UNDEFINED_CURSOR),
174-
errmsg("portal \"%s\" does not exist",stmt->portalname)));
175-
if (completionTag)
176-
strcpy(completionTag,stmt->ismove ?"MOVE 0" :"FETCH 0");
177-
return;
172+
errmsg("cursor \"%s\" does not exist",stmt->portalname)));
173+
return;/* keep compiler happy */
178174
}
179175

180176
/* Adjust dest if needed. MOVE wants destination None */
@@ -218,11 +214,10 @@ PerformPortalClose(const char *name)
218214
portal=GetPortalByName(name);
219215
if (!PortalIsValid(portal))
220216
{
221-
ereport(WARNING,
217+
ereport(ERROR,
222218
(errcode(ERRCODE_UNDEFINED_CURSOR),
223-
errmsg("portal \"%s\" does not exist",name),
224-
errfunction("PerformPortalClose")));/* for ecpg */
225-
return;
219+
errmsg("cursor \"%s\" does not exist",name)));
220+
return;/* keep compiler happy */
226221
}
227222

228223
/*

‎src/backend/utils/mmgr/portalmem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.61 2003/08/0402:40:08 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.62 2003/08/24 21:02:43 petere Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -167,11 +167,11 @@ CreatePortal(const char *name, bool allowDup, bool dupSilent)
167167
if (!allowDup)
168168
ereport(ERROR,
169169
(errcode(ERRCODE_DUPLICATE_CURSOR),
170-
errmsg("portal \"%s\" already exists",name)));
170+
errmsg("cursor \"%s\" already exists",name)));
171171
if (!dupSilent)
172172
ereport(WARNING,
173173
(errcode(ERRCODE_DUPLICATE_CURSOR),
174-
errmsg("closingpre-existingportal \"%s\"",
174+
errmsg("closing existingcursor \"%s\"",
175175
name)));
176176
PortalDrop(portal, false);
177177
}

‎src/test/regress/expected/portals.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,4 +737,4 @@ DECLARE foo26 CURSOR WITH HOLD FOR SELECT * FROM tenk1;
737737
ROLLBACK;
738738
-- should fail
739739
FETCH FROM foo26;
740-
WARNING:portal "foo26" does not exist
740+
ERROR:cursor "foo26" does not exist

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp