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
64c1fc72
Commit
64c1fc72
authored
Oct 16, 2003
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid division by zero in estimate_num_groups() when table has no rows.
parent
624292aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/selfuncs.c
+15
-9
No files found.
src/backend/utils/adt/selfuncs.c
View file @
64c1fc72
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.14
6 2003/09/25 06:58:04 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.14
7 2003/10/16 21:37:54 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2166,17 +2166,23 @@ estimate_num_groups(Query *root, List *groupExprs, double input_rows)
}
/*
*
Clamp to size of rel, multiply by restriction selectivity
.
*
Sanity check --- don't divide by zero if empty relation
.
*/
Assert
(
rel
->
reloptkind
==
RELOPT_BASEREL
);
if
(
reldistinct
>
rel
->
tuples
)
reldistinct
=
rel
->
tuples
;
reldistinct
*=
rel
->
rows
/
rel
->
tuples
;
if
(
rel
->
tuples
>
0
)
{
/*
* Clamp to size of rel, multiply by restriction selectivity.
*/
if
(
reldistinct
>
rel
->
tuples
)
reldistinct
=
rel
->
tuples
;
reldistinct
*=
rel
->
rows
/
rel
->
tuples
;
/*
* Update estimate of total distinct groups.
*/
numdistinct
*=
reldistinct
;
/*
* Update estimate of total distinct groups.
*/
numdistinct
*=
reldistinct
;
}
varinfos
=
newvarinfos
;
}
while
(
varinfos
!=
NIL
);
...
...
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