diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-10 00:49:37 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-10 00:49:37 +0000 |
commit | c5451c22e38bc3044588c596966afcbe0c29b103 (patch) | |
tree | d9de143d40c1db99a5f5fbfc5c96e061fda0b768 /src/backend/utils/cache/relcache.c | |
parent | e4718f2c9eff30dedd022fac53a1f874aa1955d8 (diff) | |
download | postgresql-c5451c22e38bc3044588c596966afcbe0c29b103.tar.gz postgresql-c5451c22e38bc3044588c596966afcbe0c29b103.zip |
Make relhasrules and relhastriggers work like relhasindex, namely we let
VACUUM reset them to false rather than trying to clean 'em up during DROP.
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r-- | src/backend/utils/cache/relcache.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 92adfd8300d..657ebf8c71f 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.275 2008/11/09 21:24:32 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.276 2008/11/10 00:49:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -722,6 +722,17 @@ RelationBuildRuleLock(Relation relation) heap_close(rewrite_desc, AccessShareLock); /* + * there might not be any rules (if relhasrules is out-of-date) + */ + if (numlocks == 0) + { + relation->rd_rules = NULL; + relation->rd_rulescxt = NULL; + MemoryContextDelete(rulescxt); + return; + } + + /* * form a RuleLock and insert into relation */ rulelock = (RuleLock *) MemoryContextAlloc(rulescxt, sizeof(RuleLock)); |