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

Change addRangeTableEntryForRelation() to take a Relation pointer instead

of just a relation OID, thereby not having to open the relation for itself.
This actually saves code rather than adding it for most of the existing
callers, which had the rel open already.  The main point though is to be
able to use this rather than plain addRangeTableEntry in setTargetTable,
thus saving one relation_openrv/relation_close cycle for every INSERT,
UPDATE, or DELETE.  Seems to provide a several percent win on simple
INSERTs.
This commit is contained in:
Tom Lane
2005-04-13 16:50:55 +00:00
parent 45c79a3094
commit 2fdf9e0be6
7 changed files with 45 additions and 57 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.281 2005/03/20 22:00:51 tgl Exp $
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.282 2005/04/13 16:50:54 tgl Exp $
*
*
* INTERFACE ROUTINES
@@ -1482,7 +1482,6 @@ AddRelationRawConstraints(Relation rel,
List *rawConstraints)
{
List *cookedConstraints = NIL;
char *relname = RelationGetRelationName(rel);
TupleDesc tupleDesc;
TupleConstr *oldconstr;
int numoldchecks;
@@ -1517,8 +1516,8 @@ AddRelationRawConstraints(Relation rel,
*/
pstate = make_parsestate(NULL);
rte = addRangeTableEntryForRelation(pstate,
RelationGetRelid(rel),
makeAlias(relname, NIL),
rel,
NULL,
false,
true);
addRTEtoQuery(pstate, rte, true, true);
@@ -1576,7 +1575,7 @@ AddRelationRawConstraints(Relation rel,
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("only table \"%s\" can be referenced in check constraint",
relname)));
RelationGetRelationName(rel))));
/*
* No subplans or aggregates, either...