mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +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:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.19 1998/08/06 05:12:16 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.20 1998/08/19 02:01:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -78,8 +78,8 @@ static Oid objectid;
|
||||
int ival;
|
||||
}
|
||||
|
||||
%type <list> boot_arg_list
|
||||
%type <ielem> boot_index_params boot_index_on
|
||||
%type <list> boot_index_params
|
||||
%type <ielem> boot_index_param
|
||||
%type <ival> boot_const boot_ident
|
||||
%type <ival> optbootstrap optoideq boot_tuple boot_tuplelist
|
||||
|
||||
@ -225,15 +225,12 @@ Boot_InsertStmt:
|
||||
Boot_DeclareIndexStmt:
|
||||
XDECLARE INDEX boot_ident ON boot_ident USING boot_ident LPAREN boot_index_params RPAREN
|
||||
{
|
||||
List *params;
|
||||
|
||||
DO_START;
|
||||
|
||||
params = lappend(NIL, (List*)$9);
|
||||
DefineIndex(LexIDStr($5),
|
||||
LexIDStr($3),
|
||||
LexIDStr($7),
|
||||
params, NIL, 0, 0, NIL);
|
||||
$9, NIL, 0, 0, NIL);
|
||||
DO_END;
|
||||
}
|
||||
;
|
||||
@ -241,39 +238,21 @@ Boot_DeclareIndexStmt:
|
||||
Boot_BuildIndsStmt:
|
||||
XBUILD INDICES { build_indices(); }
|
||||
|
||||
|
||||
boot_index_params:
|
||||
boot_index_on boot_ident
|
||||
boot_index_params COMMA boot_index_param { $$ = lappend($1, $3); }
|
||||
| boot_index_param { $$ = lcons($1, NIL); }
|
||||
;
|
||||
|
||||
boot_index_param:
|
||||
boot_ident boot_ident
|
||||
{
|
||||
IndexElem *n = (IndexElem*)$1;
|
||||
IndexElem *n = makeNode(IndexElem);
|
||||
n->name = LexIDStr($1);
|
||||
n->class = LexIDStr($2);
|
||||
$$ = n;
|
||||
}
|
||||
|
||||
boot_index_on:
|
||||
boot_ident
|
||||
{
|
||||
IndexElem *n = makeNode(IndexElem);
|
||||
n->name = LexIDStr($1);
|
||||
$$ = n;
|
||||
}
|
||||
| boot_ident LPAREN boot_arg_list RPAREN
|
||||
{
|
||||
IndexElem *n = makeNode(IndexElem);
|
||||
n->name = LexIDStr($1);
|
||||
n->args = (List*)$3;
|
||||
$$ = n;
|
||||
}
|
||||
|
||||
boot_arg_list:
|
||||
boot_ident
|
||||
{
|
||||
$$ = lappend(NIL, makeString(LexIDStr($1)));
|
||||
}
|
||||
| boot_arg_list COMMA boot_ident
|
||||
{
|
||||
$$ = lappend((List*)$1, makeString(LexIDStr($3)));
|
||||
}
|
||||
|
||||
optbootstrap:
|
||||
XBOOTSTRAP { $$ = 1; }
|
||||
| { $$ = 0; }
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.47 1998/07/27 19:37:43 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.48 1998/08/19 02:01:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -448,8 +448,8 @@ boot_openrel(char *relname)
|
||||
{
|
||||
int i;
|
||||
struct typmap **app;
|
||||
Relation rdesc;
|
||||
HeapScanDesc sdesc;
|
||||
Relation rel;
|
||||
HeapScanDesc scan;
|
||||
HeapTuple tup;
|
||||
|
||||
if (strlen(relname) >= NAMEDATALEN - 1)
|
||||
@ -458,25 +458,27 @@ boot_openrel(char *relname)
|
||||
if (Typ == (struct typmap **) NULL)
|
||||
{
|
||||
StartPortalAllocMode(DefaultAllocMode, 0);
|
||||
rdesc = heap_openr(TypeRelationName);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
for (i = 0; PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)); ++i);
|
||||
heap_endscan(sdesc);
|
||||
rel = heap_openr(TypeRelationName);
|
||||
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
i = 0;
|
||||
while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
|
||||
++i;
|
||||
heap_endscan(scan);
|
||||
app = Typ = ALLOC(struct typmap *, i + 1);
|
||||
while (i-- > 0)
|
||||
*app++ = ALLOC(struct typmap, 1);
|
||||
*app = (struct typmap *) NULL;
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
app = Typ;
|
||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
||||
while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
|
||||
{
|
||||
(*app)->am_oid = tup->t_oid;
|
||||
memmove((char *) &(*app++)->am_typ,
|
||||
(char *) GETSTRUCT(tup),
|
||||
sizeof((*app)->am_typ));
|
||||
}
|
||||
heap_endscan(sdesc);
|
||||
heap_close(rdesc);
|
||||
heap_endscan(scan);
|
||||
heap_close(rel);
|
||||
EndPortalAllocMode();
|
||||
}
|
||||
|
||||
@ -505,7 +507,7 @@ boot_openrel(char *relname)
|
||||
* defined yet.
|
||||
*/
|
||||
if (namestrcmp(&attrtypes[i]->attname, "attisset") == 0)
|
||||
attrtypes[i]->attisset = get_attisset(reldesc->rd_id,
|
||||
attrtypes[i]->attisset = get_attisset(RelationGetRelid(reldesc),
|
||||
attrtypes[i]->attname.data);
|
||||
else
|
||||
attrtypes[i]->attisset = false;
|
||||
@ -786,8 +788,8 @@ static int
|
||||
gettype(char *type)
|
||||
{
|
||||
int i;
|
||||
Relation rdesc;
|
||||
HeapScanDesc sdesc;
|
||||
Relation rel;
|
||||
HeapScanDesc scan;
|
||||
HeapTuple tup;
|
||||
struct typmap **app;
|
||||
|
||||
@ -811,27 +813,27 @@ gettype(char *type)
|
||||
}
|
||||
if (DebugMode)
|
||||
printf("bootstrap.c: External Type: %s\n", type);
|
||||
rdesc = heap_openr(TypeRelationName);
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
rel = heap_openr(TypeRelationName);
|
||||
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
i = 0;
|
||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
||||
while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
|
||||
++i;
|
||||
heap_endscan(sdesc);
|
||||
heap_endscan(scan);
|
||||
app = Typ = ALLOC(struct typmap *, i + 1);
|
||||
while (i-- > 0)
|
||||
*app++ = ALLOC(struct typmap, 1);
|
||||
*app = (struct typmap *) NULL;
|
||||
sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
scan = heap_beginscan(rel, 0, SnapshotNow, 0, (ScanKey) NULL);
|
||||
app = Typ;
|
||||
while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
|
||||
while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
|
||||
{
|
||||
(*app)->am_oid = tup->t_oid;
|
||||
memmove((char *) &(*app++)->am_typ,
|
||||
(char *) GETSTRUCT(tup),
|
||||
sizeof((*app)->am_typ));
|
||||
}
|
||||
heap_endscan(sdesc);
|
||||
heap_close(rdesc);
|
||||
heap_endscan(scan);
|
||||
heap_close(rel);
|
||||
return (gettype(type));
|
||||
}
|
||||
elog(ERROR, "Error: unknown type '%s'.\n", type);
|
||||
@ -1167,7 +1169,7 @@ build_indices()
|
||||
*/
|
||||
heap = heap_openr(ILHead->il_heap);
|
||||
|
||||
if (!BootstrapAlreadySeen(heap->rd_id))
|
||||
UpdateStats(heap->rd_id, 0, true);
|
||||
if (!BootstrapAlreadySeen(RelationGetRelid(heap)))
|
||||
UpdateStats(RelationGetRelid(heap), 0, true);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user