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:
@@ -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...
|
||||
|
Reference in New Issue
Block a user