1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

heap_fetch requires buffer pointer, must be released; heap_getnext

no longer returns buffer pointer, can be gotten from scan;
	descriptor; bootstrap can create multi-key indexes;
pg_procname index now is multi-key index; oidint2, oidint4, oidname
are gone (must be removed from regression tests); use System Cache
rather than sequential scan in many places; heap_modifytuple no
longer takes buffer parameter; remove unused buffer parameter in
a few other functions; oid8 is not index-able; remove some use of
single-character variable names; cleanup Buffer variables usage
and scan descriptor looping; cleaned up allocation and freeing of
tuples; 18k lines of diff;
This commit is contained in:
Bruce Momjian
1998-08-19 02:04:17 +00:00
parent 31de2c9461
commit 7971539020
123 changed files with 2139 additions and 3134 deletions

View File

@ -53,7 +53,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
Oid typev[8];
char nulls[Natts_pg_language];
Datum values[Natts_pg_language];
Relation rdesc;
Relation rel;
HeapTuple tup;
TupleDesc tupDesc;
@ -90,7 +90,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
memset(typev, 0, sizeof(typev));
procTup = SearchSysCacheTuple(PRONAME,
PointerGetDatum(stmt->plhandler),
UInt16GetDatum(0),
Int32GetDatum(0),
PointerGetDatum(typev),
0);
if (!HeapTupleIsValid(procTup))
@ -121,14 +121,14 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
values[i++] = ObjectIdGetDatum(procTup->t_oid);
values[i++] = (Datum) fmgr(F_TEXTIN, stmt->plcompiler);
rdesc = heap_openr(LanguageRelationName);
rel = heap_openr(LanguageRelationName);
tupDesc = rdesc->rd_att;
tupDesc = rel->rd_att;
tup = heap_formtuple(tupDesc, values, nulls);
heap_insert(rdesc, tup);
heap_insert(rel, tup);
heap_close(rdesc);
heap_close(rel);
return;
}
@ -142,11 +142,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
{
char languageName[NAMEDATALEN];
HeapTuple langTup;
Relation rdesc;
HeapScanDesc scanDesc;
ScanKeyData scanKeyData;
HeapTuple tup;
Relation rel;
/* ----------------
* Check permission
@ -165,7 +161,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
*/
case_translate_language_name(stmt->plname, languageName);
langTup = SearchSysCacheTuple(LANNAME,
langTup = SearchSysCacheTupleCopy(LANNAME,
PointerGetDatum(languageName),
0, 0, 0);
if (!HeapTupleIsValid(langTup))
@ -177,24 +173,9 @@ DropProceduralLanguage(DropPLangStmt *stmt)
languageName);
}
/* ----------------
* Now scan pg_language and delete the PL tuple
* ----------------
*/
rdesc = heap_openr(LanguageRelationName);
rel = heap_openr(LanguageRelationName);
heap_delete(rel, &langTup->t_ctid);
ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_language_lanname,
F_NAMEEQ, PointerGetDatum(languageName));
scanDesc = heap_beginscan(rdesc, 0, SnapshotNow, 1, &scanKeyData);
tup = heap_getnext(scanDesc, 0, (Buffer *) NULL);
if (!HeapTupleIsValid(tup))
elog(ERROR, "Language with name '%s' not found", languageName);
heap_delete(rdesc, &(tup->t_ctid));
heap_endscan(scanDesc);
heap_close(rdesc);
pfree(langTup);
heap_close(rel);
}