diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
commit | a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d (patch) | |
tree | 1c32737389b2530e7152dc2287161b36d9001e8c /src/backend/rewrite/rewriteManip.c | |
parent | cff23842a4c68301ddf34559c7af383bb5557054 (diff) | |
download | postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.tar.gz postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.zip |
Change SearchSysCache coding conventions so that a reference count is
maintained for each cache entry. A cache entry will not be freed until
the matching ReleaseSysCache call has been executed. This eliminates
worries about cache entries getting dropped while still in use. See
my posting to pg-hackers of even date for more info.
Diffstat (limited to 'src/backend/rewrite/rewriteManip.c')
-rw-r--r-- | src/backend/rewrite/rewriteManip.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index cffe624deb4..3e1f8f4a68d 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -7,12 +7,13 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.50 2000/10/05 19:11:34 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.51 2000/11/16 22:30:29 tgl Exp $ * *------------------------------------------------------------------------- */ #include "postgres.h" +#include "nodes/makefuncs.h" #include "optimizer/clauses.h" #include "optimizer/tlist.h" #include "parser/parsetree.h" @@ -555,20 +556,6 @@ AddNotQual(Query *parsetree, Node *qual) } -/* Build a NULL constant expression of the given type */ -static Node * -make_null(Oid type) -{ - Const *c = makeNode(Const); - - c->consttype = type; - c->constlen = get_typlen(type); - c->constvalue = PointerGetDatum(NULL); - c->constisnull = true; - c->constbyval = get_typbyval(type); - return (Node *) c; -} - /* Find a targetlist entry by resno */ static Node * FindMatchingNew(List *tlist, int attno) @@ -656,7 +643,7 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context) else { /* Otherwise replace unmatched var with a null */ - return make_null(var->vartype); + return (Node *) makeNullConst(var->vartype); } } else @@ -796,7 +783,7 @@ HandleRIRAttributeRule_mutator(Node *node, { /* HACK: disallow SET variables */ *context->modified = TRUE; *context->badsql = TRUE; - return make_null(var->vartype); + return (Node *) makeNullConst(var->vartype); } else { @@ -813,7 +800,7 @@ HandleRIRAttributeRule_mutator(Node *node, n = FindMatchingTLEntry(context->targetlist, name_to_look_for); if (n == NULL) - return make_null(var->vartype); + return (Node *) makeNullConst(var->vartype); /* Make a copy of the tlist item to return */ n = copyObject(n); |