Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
693aad41
Commit
693aad41
authored
Aug 24, 2003
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change warnings for non-existing or pre-existing cursors to errors.
parent
c3664c0c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
27 deletions
+21
-27
doc/src/sgml/ref/close.sgml
doc/src/sgml/ref/close.sgml
+3
-3
doc/src/sgml/ref/declare.sgml
doc/src/sgml/ref/declare.sgml
+3
-4
doc/src/sgml/ref/fetch.sgml
doc/src/sgml/ref/fetch.sgml
+2
-2
src/backend/commands/portalcmds.c
src/backend/commands/portalcmds.c
+9
-14
src/backend/utils/mmgr/portalmem.c
src/backend/utils/mmgr/portalmem.c
+3
-3
src/test/regress/expected/portals.out
src/test/regress/expected/portals.out
+1
-1
No files found.
doc/src/sgml/ref/close.sgml
View file @
693aad41
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/close.sgml,v 1.1
5 2003/08/17 04:46:00 momjian
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/close.sgml,v 1.1
6 2003/08/24 21:02:42 petere
Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -70,10 +70,10 @@ CLOSE <replaceable class="PARAMETER">cursor</replaceable>
...
@@ -70,10 +70,10 @@ CLOSE <replaceable class="PARAMETER">cursor</replaceable>
</varlistentry>
</varlistentry>
<varlistentry>
<varlistentry>
<term><computeroutput>
WARNING: PerformPortalClose: portal "<replaceable class="PARAMETER">cursor</replaceable>" not found
</computeroutput></term>
<term><computeroutput>
ERROR: cursor "<replaceable class="PARAMETER">cursor</replaceable>" does not exist
</computeroutput></term>
<listitem>
<listitem>
<para>
<para>
This warning is given
if <replaceable
Message returned
if <replaceable
class="PARAMETER">cursor</replaceable> is not declared or has
class="PARAMETER">cursor</replaceable> is not declared or has
already been closed.
already been closed.
</para>
</para>
...
...
doc/src/sgml/ref/declare.sgml
View file @
693aad41
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/declare.sgml,v 1.2
4 2003/05/04 02:23:16
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/declare.sgml,v 1.2
5 2003/08/24 21:02:42
petere Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -202,11 +202,10 @@ DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INS
...
@@ -202,11 +202,10 @@ DECLARE <replaceable class="parameter">cursorname</replaceable> [ BINARY ] [ INS
</varlistentry>
</varlistentry>
<varlistentry>
<varlistentry>
<term><computeroutput>
WARNING: Closing pre-existing portal "<replaceable class="parameter">cursorname</replaceable>"
</computeroutput></term>
<term><computeroutput>
ERROR: cursor "<replaceable class="parameter">cursorname</replaceable>" already exists
</computeroutput></term>
<listitem>
<listitem>
<para>
<para>
This message is reported if a cursor with the same name already
This error occurs if a cursor with the same name already exists.
exists. The previous definition is discarded.
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
...
doc/src/sgml/ref/fetch.sgml
View file @
693aad41
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/fetch.sgml,v 1.
29 2003/05/04 02:23:16
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/fetch.sgml,v 1.
30 2003/08/24 21:02:43
petere Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -281,7 +281,7 @@ where <replaceable class="PARAMETER">direction</replaceable> can be empty or one
...
@@ -281,7 +281,7 @@ where <replaceable class="PARAMETER">direction</replaceable> can be empty or one
<variablelist>
<variablelist>
<varlistentry>
<varlistentry>
<term><computeroutput>
WARNING: PerformPortalFetch: portal "<replaceable class="PARAMETER">cursor</replaceable>" not found
</computeroutput></term>
<term><computeroutput>
ERROR: cursor "<replaceable class="PARAMETER">cursor</replaceable>" does not exist
</computeroutput></term>
<listitem>
<listitem>
<para>
<para>
There is no cursor with the specified name.
There is no cursor with the specified name.
...
...
src/backend/commands/portalcmds.c
View file @
693aad41
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.2
3 2003/08/08 21:41:32 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.2
4 2003/08/24 21:02:43 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -88,10 +88,9 @@ PerformCursorOpen(DeclareCursorStmt *stmt)
...
@@ -88,10 +88,9 @@ PerformCursorOpen(DeclareCursorStmt *stmt)
/*
/*
* Create a portal and copy the query and plan into its memory
* Create a portal and copy the query and plan into its memory
* context. (If a duplicate cursor name already exists, warn and drop
* context.
* it.)
*/
*/
portal
=
CreatePortal
(
stmt
->
portalname
,
tru
e
,
false
);
portal
=
CreatePortal
(
stmt
->
portalname
,
fals
e
,
false
);
oldContext
=
MemoryContextSwitchTo
(
PortalGetHeapMemory
(
portal
));
oldContext
=
MemoryContextSwitchTo
(
PortalGetHeapMemory
(
portal
));
...
@@ -168,13 +167,10 @@ PerformPortalFetch(FetchStmt *stmt,
...
@@ -168,13 +167,10 @@ PerformPortalFetch(FetchStmt *stmt,
portal
=
GetPortalByName
(
stmt
->
portalname
);
portal
=
GetPortalByName
(
stmt
->
portalname
);
if
(
!
PortalIsValid
(
portal
))
if
(
!
PortalIsValid
(
portal
))
{
{
/* FIXME: shouldn't this be an ERROR? */
ereport
(
ERROR
,
ereport
(
WARNING
,
(
errcode
(
ERRCODE_UNDEFINED_CURSOR
),
(
errcode
(
ERRCODE_UNDEFINED_CURSOR
),
errmsg
(
"portal
\"
%s
\"
does not exist"
,
stmt
->
portalname
)));
errmsg
(
"cursor
\"
%s
\"
does not exist"
,
stmt
->
portalname
)));
if
(
completionTag
)
return
;
/* keep compiler happy */
strcpy
(
completionTag
,
stmt
->
ismove
?
"MOVE 0"
:
"FETCH 0"
);
return
;
}
}
/* Adjust dest if needed. MOVE wants destination None */
/* Adjust dest if needed. MOVE wants destination None */
...
@@ -218,11 +214,10 @@ PerformPortalClose(const char *name)
...
@@ -218,11 +214,10 @@ PerformPortalClose(const char *name)
portal
=
GetPortalByName
(
name
);
portal
=
GetPortalByName
(
name
);
if
(
!
PortalIsValid
(
portal
))
if
(
!
PortalIsValid
(
portal
))
{
{
ereport
(
WARNING
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_UNDEFINED_CURSOR
),
(
errcode
(
ERRCODE_UNDEFINED_CURSOR
),
errmsg
(
"portal
\"
%s
\"
does not exist"
,
name
),
errmsg
(
"cursor
\"
%s
\"
does not exist"
,
name
)));
errfunction
(
"PerformPortalClose"
)));
/* for ecpg */
return
;
/* keep compiler happy */
return
;
}
}
/*
/*
...
...
src/backend/utils/mmgr/portalmem.c
View file @
693aad41
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.6
1 2003/08/04 02:40:08 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.6
2 2003/08/24 21:02:43 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -167,11 +167,11 @@ CreatePortal(const char *name, bool allowDup, bool dupSilent)
...
@@ -167,11 +167,11 @@ CreatePortal(const char *name, bool allowDup, bool dupSilent)
if
(
!
allowDup
)
if
(
!
allowDup
)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_DUPLICATE_CURSOR
),
(
errcode
(
ERRCODE_DUPLICATE_CURSOR
),
errmsg
(
"
portal
\"
%s
\"
already exists"
,
name
)));
errmsg
(
"
cursor
\"
%s
\"
already exists"
,
name
)));
if
(
!
dupSilent
)
if
(
!
dupSilent
)
ereport
(
WARNING
,
ereport
(
WARNING
,
(
errcode
(
ERRCODE_DUPLICATE_CURSOR
),
(
errcode
(
ERRCODE_DUPLICATE_CURSOR
),
errmsg
(
"closing
pre-existing portal
\"
%s
\"
"
,
errmsg
(
"closing
existing cursor
\"
%s
\"
"
,
name
)));
name
)));
PortalDrop
(
portal
,
false
);
PortalDrop
(
portal
,
false
);
}
}
...
...
src/test/regress/expected/portals.out
View file @
693aad41
...
@@ -737,4 +737,4 @@ DECLARE foo26 CURSOR WITH HOLD FOR SELECT * FROM tenk1;
...
@@ -737,4 +737,4 @@ DECLARE foo26 CURSOR WITH HOLD FOR SELECT * FROM tenk1;
ROLLBACK;
ROLLBACK;
-- should fail
-- should fail
FETCH FROM foo26;
FETCH FROM foo26;
WARNING: portal
"foo26" does not exist
ERROR: cursor
"foo26" does not exist
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment