Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
688784f6
Commit
688784f6
authored
19 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Prevent planner from including temp tables of other backends when expanding
an inheritance tree. Per recent discussions.
parent
558730ac
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/optimizer/prep/prepunion.c
+23
-1
23 additions, 1 deletion
src/backend/optimizer/prep/prepunion.c
with
23 additions
and
1 deletion
src/backend/optimizer/prep/prepunion.c
+
23
−
1
View file @
688784f6
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.12
5
2005/0
7/28
2
2
:27:
00
tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.12
6
2005/0
8/02
2
0
:27:
45
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include
"access/heapam.h"
#include
"access/heapam.h"
#include
"catalog/namespace.h"
#include
"catalog/pg_type.h"
#include
"catalog/pg_type.h"
#include
"nodes/makefuncs.h"
#include
"nodes/makefuncs.h"
#include
"optimizer/clauses.h"
#include
"optimizer/clauses.h"
...
@@ -807,6 +808,16 @@ expand_inherited_rtentry(PlannerInfo *root, Index rti)
...
@@ -807,6 +808,16 @@ expand_inherited_rtentry(PlannerInfo *root, Index rti)
RangeTblEntry
*
childrte
;
RangeTblEntry
*
childrte
;
Index
childRTindex
;
Index
childRTindex
;
/*
* It is possible that the parent table has children that are
* temp tables of other backends. We cannot safely access such
* tables (because of buffering issues), and the best thing to do
* seems to be to silently ignore them.
*/
if
(
childOID
!=
parentOID
&&
isOtherTempNamespace
(
get_rel_namespace
(
childOID
)))
continue
;
/*
/*
* Build an RTE for the child, and attach to query's rangetable
* Build an RTE for the child, and attach to query's rangetable
* list. We copy most fields of the parent's RTE, but replace
* list. We copy most fields of the parent's RTE, but replace
...
@@ -820,6 +831,17 @@ expand_inherited_rtentry(PlannerInfo *root, Index rti)
...
@@ -820,6 +831,17 @@ expand_inherited_rtentry(PlannerInfo *root, Index rti)
inhRTIs
=
lappend_int
(
inhRTIs
,
childRTindex
);
inhRTIs
=
lappend_int
(
inhRTIs
,
childRTindex
);
}
}
/*
* If all the children were temp tables, pretend it's a non-inheritance
* situation. The duplicate RTE we added for the parent table is harmless.
*/
if
(
list_length
(
inhRTIs
)
<
2
)
{
/* Clear flag to save repeated tests if called again */
rte
->
inh
=
false
;
return
NIL
;
}
/*
/*
* The executor will check the parent table's access permissions when
* The executor will check the parent table's access permissions when
* it examines the parent's inheritlist entry. There's no need to
* it examines the parent's inheritlist entry. There's no need to
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment