Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
688784f6
Commit
688784f6
authored
Aug 02, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent planner from including temp tables of other backends when expanding
an inheritance tree. Per recent discussions.
parent
558730ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/prep/prepunion.c
+23
-1
No files found.
src/backend/optimizer/prep/prepunion.c
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/07/28 22:27:00
tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.12
6 2005/08/02 20: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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment