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

Commit6458daa

Browse files
committed
Running lo_read/lo_write under different memory context
cause troubles. SeeMessage-Id: <199905090312.MAA00466@ext16.sra.co.jp>for more details.
1 parent202e523 commit6458daa

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

‎src/backend/libpq/be-fsstubs.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.30 1999/05/09 00:54:30 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.31 1999/05/0915:00:18 ishii Exp $
1111
*
1212
* NOTES
1313
* This should be moved to a more appropriate place. It is here
@@ -131,6 +131,9 @@ lo_close(int fd)
131131
int
132132
lo_read(intfd,char*buf,intlen)
133133
{
134+
MemoryContextcurrentContext;
135+
intstatus;
136+
134137
if (fd<0||fd >=MAX_LOBJ_FDS)
135138
{
136139
elog(ERROR,"lo_read: large obj descriptor (%d) out of range",fd);
@@ -141,13 +144,20 @@ lo_read(int fd, char *buf, int len)
141144
elog(ERROR,"lo_read: invalid large obj descriptor (%d)",fd);
142145
return-3;
143146
}
147+
currentContext=MemoryContextSwitchTo((MemoryContext)fscxt);
148+
149+
status=inv_read(cookies[fd],buf,len);
144150

145-
returninv_read(cookies[fd],buf,len);
151+
MemoryContextSwitchTo(currentContext);
152+
return(status);
146153
}
147154

148155
int
149156
lo_write(intfd,char*buf,intlen)
150157
{
158+
MemoryContextcurrentContext;
159+
intstatus;
160+
151161
if (fd<0||fd >=MAX_LOBJ_FDS)
152162
{
153163
elog(ERROR,"lo_write: large obj descriptor (%d) out of range",fd);
@@ -158,8 +168,12 @@ lo_write(int fd, char *buf, int len)
158168
elog(ERROR,"lo_write: invalid large obj descriptor (%d)",fd);
159169
return-3;
160170
}
171+
currentContext=MemoryContextSwitchTo((MemoryContext)fscxt);
172+
173+
status=inv_write(cookies[fd],buf,len);
161174

162-
returninv_write(cookies[fd],buf,len);
175+
MemoryContextSwitchTo(currentContext);
176+
return(status);
163177
}
164178

165179

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp