pgsql: Mark built-in coercion functions as leakproof where possible.

2020-07-25 Thread Tom Lane
Mark built-in coercion functions as leakproof where possible. Making these leakproof seems helpful since (for example) if you have a function f(int8) that is leakproof, you don't want it to effectively become non-leakproof when you apply it to an int4 or int2 column. But that's what happens today,

pgsql: Improve performance of binary COPY FROM through better buffering

2020-07-25 Thread Tom Lane
Improve performance of binary COPY FROM through better buffering. At least on Linux and macOS, fread() turns out to have far higher per-call overhead than one could wish. Reading 64KB of data at a time and then parceling it out with our own memcpy logic makes binary COPY from a file significantly

pgsql: Remove optimization for RAND_poll() failing.

2020-07-25 Thread Noah Misch
Remove optimization for RAND_poll() failing. The loop to generate seed data will exit on RAND_status(), so we don't need to handle the case of RAND_poll() failing separately. Failures here are rare, so this a code cleanup, essentially. Daniel Gustafsson, reviewed by David Steele and Michael Paqu

pgsql: Use RAND_poll() for seeding randomness after fork().

2020-07-25 Thread Noah Misch
Use RAND_poll() for seeding randomness after fork(). OpenSSL deprecated RAND_cleanup(), and OpenSSL 1.1.0 made it into a no-op. Replace it with RAND_poll(), per an OpenSSL community recommendation. While this has no user-visible consequences under OpenSSL defaults, it might help under non-defaul