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

Commita753e5d

Browse files
committed
Fix for possible releasebuffer bug.
1 parent6c49828 commita753e5d

File tree

2 files changed

+34
-35
lines changed

2 files changed

+34
-35
lines changed

‎src/backend/catalog/indexing.c

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.22 1998/08/20 22:07:36 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.23 1998/08/30 23:25:55 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -227,31 +227,26 @@ CatalogIndexFetchTuple(Relation heapRelation,
227227
{
228228
IndexScanDescsd;
229229
RetrieveIndexResultindexRes;
230-
HeapTupletuple;
230+
HeapTupletuple=NULL;
231231
Bufferbuffer;
232232

233233
sd=index_beginscan(idesc, false,num_keys,skey);
234-
tuple= (HeapTuple)NULL;
235-
do
234+
while ((indexRes=index_getnext(sd,ForwardScanDirection)))
236235
{
237-
indexRes=index_getnext(sd,ForwardScanDirection);
238-
if (indexRes)
239-
{
240-
ItemPointeriptr;
236+
ItemPointeriptr;
241237

242-
iptr=&indexRes->heap_iptr;
243-
tuple=heap_fetch(heapRelation,SnapshotNow,iptr,&buffer);
244-
pfree(indexRes);
245-
}
246-
else
238+
iptr=&indexRes->heap_iptr;
239+
tuple=heap_fetch(heapRelation,SnapshotNow,iptr,&buffer);
240+
pfree(indexRes);
241+
if (HeapTupleIsValid(tuple))
247242
break;
248-
}while (!HeapTupleIsValid(tuple));
243+
}
249244

250245
if (HeapTupleIsValid(tuple))
246+
{
251247
tuple=heap_copytuple(tuple);
252-
253-
if (BufferIsValid(buffer))
254248
ReleaseBuffer(buffer);
249+
}
255250

256251
index_endscan(sd);
257252
pfree(sd);
@@ -333,7 +328,7 @@ ProcedureOidIndexScan(Relation heapRelation, Oid procId)
333328
(bits16)0x0,
334329
(AttrNumber)1,
335330
(RegProcedure)F_OIDEQ,
336-
(Datum)procId);
331+
ObjectIdGetDatum(procId));
337332

338333
idesc=index_openr(ProcedureOidIndex);
339334
tuple=CatalogIndexFetchTuple(heapRelation,idesc,skey,1);
@@ -359,7 +354,7 @@ ProcedureNameIndexScan(Relation heapRelation,
359354
(bits16)0x0,
360355
(AttrNumber)1,
361356
(RegProcedure)F_NAMEEQ,
362-
(Datum)procName);
357+
PointerGetDatum(procName));
363358

364359
ScanKeyEntryInitialize(&skey[1],
365360
(bits16)0x0,
@@ -371,7 +366,7 @@ ProcedureNameIndexScan(Relation heapRelation,
371366
(bits16)0x0,
372367
(AttrNumber)3,
373368
(RegProcedure)F_OID8EQ,
374-
(Datum)argTypes);
369+
PointerGetDatum(argTypes));
375370

376371
idesc=index_openr(ProcedureNameIndex);
377372
tuple=CatalogIndexFetchTuple(heapRelation,idesc,skey,3);
@@ -394,7 +389,7 @@ ProcedureSrcIndexScan(Relation heapRelation, text *procSrc)
394389
(bits16)0x0,
395390
(AttrNumber)1,
396391
(RegProcedure)F_TEXTEQ,
397-
(Datum)procSrc);
392+
PointerGetDatum(procSrc));
398393

399394
idesc=index_openr(ProcedureSrcIndex);
400395
tuple=CatalogIndexFetchTuple(heapRelation,idesc,skey,1);
@@ -415,7 +410,7 @@ TypeOidIndexScan(Relation heapRelation, Oid typeId)
415410
(bits16)0x0,
416411
(AttrNumber)1,
417412
(RegProcedure)F_OIDEQ,
418-
(Datum)typeId);
413+
ObjectIdGetDatum(typeId));
419414

420415
idesc=index_openr(TypeOidIndex);
421416
tuple=CatalogIndexFetchTuple(heapRelation,idesc,skey,1);
@@ -436,7 +431,7 @@ TypeNameIndexScan(Relation heapRelation, char *typeName)
436431
(bits16)0x0,
437432
(AttrNumber)1,
438433
(RegProcedure)F_NAMEEQ,
439-
(Datum)typeName);
434+
PointerGetDatum(typeName));
440435

441436
idesc=index_openr(TypeNameIndex);
442437
tuple=CatalogIndexFetchTuple(heapRelation,idesc,skey,1);
@@ -477,7 +472,7 @@ ClassOidIndexScan(Relation heapRelation, Oid relId)
477472
(bits16)0x0,
478473
(AttrNumber)1,
479474
(RegProcedure)F_OIDEQ,
480-
(Datum)relId);
475+
ObjectIdGetDatum(relId));
481476

482477
idesc=index_openr(ClassOidIndex);
483478
tuple=CatalogIndexFetchTuple(heapRelation,idesc,skey,1);

‎src/backend/parser/scan.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* A lexical scanner generated by flex */
22

33
/* Scanner skeleton version:
4-
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.24 1998/08/23 22:25:51 momjian Exp $
4+
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.25 1998/08/30 23:25:56 momjian Exp $
55
*/
66

77
#defineFLEX_SCANNER
@@ -555,7 +555,7 @@ char *yytext;
555555
*
556556
*
557557
* IDENTIFICATION
558-
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.24 1998/08/23 22:25:51 momjian Exp $
558+
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.25 1998/08/30 23:25:56 momjian Exp $
559559
*
560560
*-------------------------------------------------------------------------
561561
*/
@@ -1181,6 +1181,8 @@ YY_RULE_SETUP
11811181
if (isascii((unsignedchar)yytext[i])&&
11821182
isupper(yytext[i]))
11831183
yytext[i]=tolower(yytext[i]);
1184+
if (i >=NAMEDATALEN)
1185+
yytext[NAMEDATALEN-1]='\0';
11841186

11851187
keyword=ScanKeywordLookup((char*)yytext);
11861188
if (keyword!=NULL) {
@@ -1195,7 +1197,7 @@ YY_RULE_SETUP
11951197
YY_BREAK
11961198
case34:
11971199
YY_RULE_SETUP
1198-
#line337 "scan.l"
1200+
#line339 "scan.l"
11991201
{
12001202
char*endptr;
12011203

@@ -1217,7 +1219,7 @@ YY_RULE_SETUP
12171219
YY_BREAK
12181220
case35:
12191221
YY_RULE_SETUP
1220-
#line355 "scan.l"
1222+
#line357 "scan.l"
12211223
{
12221224
char*endptr;
12231225

@@ -1232,7 +1234,7 @@ YY_RULE_SETUP
12321234
YY_BREAK
12331235
case36:
12341236
YY_RULE_SETUP
1235-
#line366 "scan.l"
1237+
#line368 "scan.l"
12361238
{
12371239
char*endptr;
12381240

@@ -1253,7 +1255,7 @@ YY_RULE_SETUP
12531255
YY_BREAK
12541256
case37:
12551257
YY_RULE_SETUP
1256-
#line383 "scan.l"
1258+
#line385 "scan.l"
12571259
{
12581260
char*endptr;
12591261

@@ -1267,7 +1269,7 @@ YY_RULE_SETUP
12671269
YY_BREAK
12681270
case38:
12691271
YY_RULE_SETUP
1270-
#line395 "scan.l"
1272+
#line397 "scan.l"
12711273
{
12721274
inti;
12731275
ScanKeyword*keyword;
@@ -1276,6 +1278,8 @@ YY_RULE_SETUP
12761278
if (isascii((unsignedchar)yytext[i])&&
12771279
isupper(yytext[i]))
12781280
yytext[i]=tolower(yytext[i]);
1281+
if (i >=NAMEDATALEN)
1282+
yytext[NAMEDATALEN-1]='\0';
12791283

12801284
keyword=ScanKeywordLookup((char*)yytext);
12811285
if (keyword!=NULL) {
@@ -1290,20 +1294,20 @@ YY_RULE_SETUP
12901294
YY_BREAK
12911295
case39:
12921296
YY_RULE_SETUP
1293-
#line414 "scan.l"
1297+
#line418 "scan.l"
12941298
{/* ignore */ }
12951299
YY_BREAK
12961300
case40:
12971301
YY_RULE_SETUP
1298-
#line416 "scan.l"
1302+
#line420 "scan.l"
12991303
{return (yytext[0]); }
13001304
YY_BREAK
13011305
case41:
13021306
YY_RULE_SETUP
1303-
#line418 "scan.l"
1307+
#line422 "scan.l"
13041308
ECHO;
13051309
YY_BREAK
1306-
#line1307 "lex.yy.c"
1310+
#line1311 "lex.yy.c"
13071311
caseYY_STATE_EOF(INITIAL):
13081312
caseYY_STATE_EOF(xb):
13091313
caseYY_STATE_EOF(xc):
@@ -2189,7 +2193,7 @@ int main()
21892193
return0;
21902194
}
21912195
#endif
2192-
#line418 "scan.l"
2196+
#line422 "scan.l"
21932197

21942198

21952199
voidyyerror(charmessage[])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp