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
655473a7
Commit
655473a7
authored
Jul 24, 2009
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add commentary about Cygwin's broken erand48, per report from Andrew Dunstan.
parent
dc7aa365
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
configure
configure
+2
-1
configure.in
configure.in
+3
-2
src/backend/optimizer/geqo/geqo_selection.c
src/backend/optimizer/geqo/geqo_selection.c
+15
-7
No files found.
configure
View file @
655473a7
...
...
@@ -19085,7 +19085,8 @@ esac
fi
# Cygwin's erand48 sometimes hangs, so force use of ours
# Cygwin's erand48() is broken (always returns zero) in some releases,
# so force use of ours.
if
test
"
$PORTNAME
"
=
"cygwin"
;
then
case
"
$LIBOBJS
"
in
*
" erand48.
$ac_objext
"
*
)
;;
...
...
configure.in
View file @
655473a7
dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.60
6 2009/07/23 23:50:29 adunstan
Exp $
dnl $PostgreSQL: pgsql/configure.in,v 1.60
7 2009/07/24 15:03:07 tgl
Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
...
...
@@ -1289,7 +1289,8 @@ if test "$PORTNAME" = "solaris"; then
AC_LIBOBJ(getopt)
fi
# Cygwin's erand48 sometimes hangs, so force use of ours
# Cygwin's erand48() is broken (always returns zero) in some releases,
# so force use of ours.
if test "$PORTNAME" = "cygwin"; then
AC_LIBOBJ(erand48)
fi
...
...
src/backend/optimizer/geqo/geqo_selection.c
View file @
655473a7
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_selection.c,v 1.2
5 2009/07/16 20:55:44
tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_selection.c,v 1.2
6 2009/07/24 15:03:07
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -42,7 +42,7 @@
#include "optimizer/geqo_random.h"
#include "optimizer/geqo_selection.h"
static
int
linear
(
PlannerInfo
*
root
,
int
max
,
double
bias
);
static
int
linear
_rand
(
PlannerInfo
*
root
,
int
max
,
double
bias
);
/*
...
...
@@ -57,13 +57,21 @@ geqo_selection(PlannerInfo *root, Chromosome *momma, Chromosome *daddy,
int
first
,
second
;
first
=
linear
(
root
,
pool
->
size
,
bias
);
second
=
linear
(
root
,
pool
->
size
,
bias
);
first
=
linear
_rand
(
root
,
pool
->
size
,
bias
);
second
=
linear
_rand
(
root
,
pool
->
size
,
bias
);
/*
* Ensure we have selected different genes, except if pool size is only
* one, when we can't.
*
* This code has been observed to hang up in an infinite loop when the
* platform's implementation of erand48() is broken. We consider that a
* feature: it lets you know you'd better fix the random-number generator.
*/
if
(
pool
->
size
>
1
)
{
while
(
first
==
second
)
second
=
linear
(
root
,
pool
->
size
,
bias
);
second
=
linear
_rand
(
root
,
pool
->
size
,
bias
);
}
geqo_copy
(
root
,
momma
,
&
pool
->
data
[
first
],
pool
->
string_length
);
...
...
@@ -71,7 +79,7 @@ geqo_selection(PlannerInfo *root, Chromosome *momma, Chromosome *daddy,
}
/*
* linear
* linear
_rand
* generates random integer between 0 and input max number
* using input linear bias
*
...
...
@@ -81,7 +89,7 @@ geqo_selection(PlannerInfo *root, Chromosome *momma, Chromosome *daddy,
* bias = (prob of first rule) / (prob of middle rule)
*/
static
int
linear
(
PlannerInfo
*
root
,
int
pool_size
,
double
bias
)
linear
_rand
(
PlannerInfo
*
root
,
int
pool_size
,
double
bias
)
{
double
index
;
/* index between 0 and pop_size */
double
max
=
(
double
)
pool_size
;
...
...
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