diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-22 02:56:37 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-22 02:56:37 +0000 |
commit | 108a0ec87d41393c362c5b8d8aa17d9a734e4f1a (patch) | |
tree | f437cf9d8bb1db8fdacf1c1022eac0f11e146069 /src/backend/rewrite/rewriteHandler.c | |
parent | 56c9b73c1d426c79a604df6d6f36293dd9f18754 (diff) | |
download | postgresql-108a0ec87d41393c362c5b8d8aa17d9a734e4f1a.tar.gz postgresql-108a0ec87d41393c362c5b8d8aa17d9a734e4f1a.zip |
A little further progress on schemas: push down RangeVars into
addRangeTableEntry calls. Remove relname field from RTEs, since
it will no longer be a useful unique identifier of relations;
we want to encourage people to rely on the relation OID instead.
Further work on dumping qual expressions in EXPLAIN, too.
Diffstat (limited to 'src/backend/rewrite/rewriteHandler.c')
-rw-r--r-- | src/backend/rewrite/rewriteHandler.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c index e118654e404..aebc7b94f86 100644 --- a/src/backend/rewrite/rewriteHandler.c +++ b/src/backend/rewrite/rewriteHandler.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.99 2002/03/12 00:51:58 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.100 2002/03/22 02:56:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -290,7 +290,6 @@ ApplyRetrieveRule(Query *parsetree, rte = rt_fetch(rt_index, parsetree->rtable); rte->rtekind = RTE_SUBQUERY; - rte->relname = NULL; rte->relid = InvalidOid; rte->subquery = rule_action; rte->inh = false; /* must not be set for a subquery */ @@ -485,17 +484,7 @@ fireRIRrules(Query *parsetree) else lockmode = AccessShareLock; - rel = heap_openr(rte->relname, lockmode); - - /* - * Check to see if relation's OID matches the RTE. If not, the - * RTE actually refers to an older relation that had the same - * name. Eventually we might want to reparse the referencing rule, - * but for now all we can do is punt. - */ - if (RelationGetRelid(rel) != rte->relid) - elog(ERROR, "Relation \"%s\" with OID %u no longer exists", - rte->relname, rte->relid); + rel = heap_open(rte->relid, lockmode); /* * Collect the RIR rules that we must apply @@ -773,17 +762,7 @@ RewriteQuery(Query *parsetree, bool *instead_flag, List **qual_products) * release it until end of transaction. This protects the rewriter * and planner against schema changes mid-query. */ - rt_entry_relation = heap_openr(rt_entry->relname, RowExclusiveLock); - - /* - * Check to see if relation's OID matches the RTE. If not, the RTE - * actually refers to an older relation that had the same name. - * Eventually we might want to reparse the referencing rule, but for - * now all we can do is punt. - */ - if (RelationGetRelid(rt_entry_relation) != rt_entry->relid) - elog(ERROR, "Relation \"%s\" with OID %u no longer exists", - rt_entry->relname, rt_entry->relid); + rt_entry_relation = heap_open(rt_entry->relid, RowExclusiveLock); /* * Collect and apply the appropriate rules. |