diff options
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 5903b228905..98180ed52ab 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -3611,6 +3611,14 @@ PostgresMain(int argc, char *argv[], MyProcPid = getpid(); MyStartTime = time(NULL); + + /* + * Initialize random() for the first time, like PostmasterMain() + * would. In a regular IsUnderPostmaster backend, BackendRun() + * computes a high-entropy seed before any user query. Fewer distinct + * initial seeds can occur here. + */ + srandom((unsigned int) (MyProcPid ^ MyStartTime)); } SetProcessingMode(InitProcessing); |