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
09a8912f
Commit
09a8912f
authored
Oct 25, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure clause_selectivity() behaves sanely when examining an uplevel Var
or a Var that references a subquery output.
parent
4ad9fe4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
16 deletions
+32
-16
src/backend/optimizer/path/clausesel.c
src/backend/optimizer/path/clausesel.c
+32
-16
No files found.
src/backend/optimizer/path/clausesel.c
View file @
09a8912f
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.
39 2000/08/13 02:50:04
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.
40 2000/10/25 21:48:12
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -371,24 +371,40 @@ clause_selectivity(Query *root,
...
@@ -371,24 +371,40 @@ clause_selectivity(Query *root,
return
s1
;
return
s1
;
if
(
IsA
(
clause
,
Var
))
if
(
IsA
(
clause
,
Var
))
{
{
Var
*
var
=
(
Var
*
)
clause
;
/*
/*
* we have a bool Var. This is exactly equivalent to the clause:
* We probably shouldn't ever see an uplevel Var here, but if we
* reln.attribute = 't' so we compute the selectivity as if that
* do, return the default selectivity...
* is what we have. The magic #define constants are a hack. I
* didn't want to have to do system cache look ups to find out all
* of that info.
*/
*/
Index
varno
=
((
Var
*
)
clause
)
->
varno
;
if
(
var
->
varlevelsup
==
0
&&
(
varRelid
==
0
||
varRelid
==
(
int
)
var
->
varno
))
if
(
varRelid
==
0
||
varRelid
==
(
int
)
varno
)
{
s1
=
restriction_selectivity
(
F_EQSEL
,
RangeTblEntry
*
rte
=
rt_fetch
(
var
->
varno
,
root
->
rtable
);
BooleanEqualOperator
,
getrelid
(
varno
,
root
->
rtable
),
if
(
rte
->
subquery
)
((
Var
*
)
clause
)
->
varattno
,
{
BoolGetDatum
(
true
),
/*
SEL_CONSTANT
|
SEL_RIGHT
);
* XXX not smart about subquery references...
/* an outer-relation bool var is taken as always true... */
* any way to do better?
*/
s1
=
0
.
5
;
}
else
{
/*
* A Var at the top of a clause must be a bool Var.
* This is equivalent to the clause reln.attribute = 't',
* so we compute the selectivity as if that is what we have.
*/
s1
=
restriction_selectivity
(
F_EQSEL
,
BooleanEqualOperator
,
rte
->
relid
,
var
->
varattno
,
BoolGetDatum
(
true
),
SEL_CONSTANT
|
SEL_RIGHT
);
}
}
}
}
else
if
(
IsA
(
clause
,
Param
))
else
if
(
IsA
(
clause
,
Param
))
{
{
...
...
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