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

Commit 19cc38b

Browse files
committed
Large object write-into-middle fix from Tatsuo Ishii.
1 parent fc590b6 commit 19cc38b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/backend/storage/large_object/inv_api.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.47 1999/02/03 21:17:20 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.48 1999/02/04 14:52:00 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -540,10 +540,16 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
540540
else
541541
{
542542
if (obj_desc->offset > obj_desc->highbyte)
543+
{
543544
tuplen = inv_wrnew(obj_desc, buf, nbytes - nwritten);
545+
ReleaseBuffer(buffer);
546+
}
544547
else
545548
tuplen = inv_wrold(obj_desc, buf, nbytes - nwritten, &tuple, buffer);
546-
ReleaseBuffer(buffer);
549+
/* inv_wrold() has already issued WriteBuffer()
550+
which has decremented local reference counter
551+
(LocalRefCount). So we should not call
552+
ReleaseBuffer() here. -- Tatsuo 99/2/4 */
547553
}
548554

549555
/* move pointers past the amount we just wrote */

0 commit comments

Comments
 (0)