pgsql: Treat directory open failures as hard errors in ResetUnloggedRel

2017-12-04 Thread Tom Lane
Treat directory open failures as hard errors in ResetUnloggedRelations(). Previously, this code just reported such problems at LOG level and kept going. The problem with this approach is that transient failures (e.g., ENFILE) could prevent us from resetting unlogged relations to empty, yet allow

Re: [COMMITTERS] pgsql: Add more efficient functions to pqformat API.

2017-12-04 Thread Andres Freund
On 2017-12-04 19:58:01 -0500, Peter Eisentraut wrote: > On 11/30/17 14:49, Peter Eisentraut wrote: > > On 10/11/17 19:11, Andres Freund wrote: > >> 3) Add pq_writeint$width(), pq_writestring(). These rely on sufficient > >>space in the StringInfo's buffer, avoiding individual space checks > >>

Re: [COMMITTERS] pgsql: Add more efficient functions to pqformat API.

2017-12-04 Thread Peter Eisentraut
On 11/30/17 14:49, Peter Eisentraut wrote: > On 10/11/17 19:11, Andres Freund wrote: >> 3) Add pq_writeint$width(), pq_writestring(). These rely on sufficient >>space in the StringInfo's buffer, avoiding individual space checks >>& potential individual resizing. To allow this to be used fo

pgsql: Fix warnings from cpluspluscheck

2017-12-04 Thread Peter Eisentraut
Fix warnings from cpluspluscheck Fix warnings about "comparison between signed and unsigned integer expressions" in inline functions in header files by adding some casts. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e7cfb26fbc11ea94e93e443e2260e106b6daabdd Modif

Re: pgsql: Add some regression tests that exercise hash join code.

2017-12-04 Thread Thomas Munro
On Tue, Dec 5, 2017 at 9:21 AM, Andres Freund wrote: > On 2017-12-04 12:28:56 +1300, Thomas Munro wrote: >> From 43eeea0bc35204440d262224b56efca958b33428 Mon Sep 17 00:00:00 2001 >> From: Thomas Munro >> Date: Mon, 4 Dec 2017 11:52:11 +1300 >> Subject: [PATCH] Fix EXPLAIN ANALYZE of hash join whe

pgsql: Simplify do_pg_start_backup's API by opening pg_tblspc internall

2017-12-04 Thread Tom Lane
Simplify do_pg_start_backup's API by opening pg_tblspc internally. do_pg_start_backup() expects its callers to pass in an open DIR pointer for the pg_tblspc directory, but there's no apparent advantage in that. It complicates the callers without adding any flexibility, and there's no robustness ad

pgsql: Improve error handling in RemovePgTempFiles().

2017-12-04 Thread Tom Lane
Improve error handling in RemovePgTempFiles(). Modify this function and its subsidiaries so that syscall failures are reported via ereport(LOG), rather than silently ignored as before. We don't want to throw a hard ERROR, as that would prevent database startup, and getting rid of leftover temporar

pgsql: Clean up assorted messiness around AllocateDir() usage.

2017-12-04 Thread Tom Lane
Clean up assorted messiness around AllocateDir() usage. This patch fixes a couple of low-probability bugs that could lead to reporting an irrelevant errno value (and hence possibly a wrong SQLSTATE) concerning directory-open or file-open failures. It also fixes places where we took shortcuts in r

pgsql: Clean up assorted messiness around AllocateDir() usage.

2017-12-04 Thread Tom Lane
Clean up assorted messiness around AllocateDir() usage. This patch fixes a couple of low-probability bugs that could lead to reporting an irrelevant errno value (and hence possibly a wrong SQLSTATE) concerning directory-open or file-open failures. It also fixes places where we took shortcuts in r

pgsql: Clean up assorted messiness around AllocateDir() usage.

2017-12-04 Thread Tom Lane
Clean up assorted messiness around AllocateDir() usage. This patch fixes a couple of low-probability bugs that could lead to reporting an irrelevant errno value (and hence possibly a wrong SQLSTATE) concerning directory-open or file-open failures. It also fixes places where we took shortcuts in r

pgsql: Clean up assorted messiness around AllocateDir() usage.

2017-12-04 Thread Tom Lane
Clean up assorted messiness around AllocateDir() usage. This patch fixes a couple of low-probability bugs that could lead to reporting an irrelevant errno value (and hence possibly a wrong SQLSTATE) concerning directory-open or file-open failures. It also fixes places where we took shortcuts in r

pgsql: Clean up assorted messiness around AllocateDir() usage.

2017-12-04 Thread Tom Lane
Clean up assorted messiness around AllocateDir() usage. This patch fixes a couple of low-probability bugs that could lead to reporting an irrelevant errno value (and hence possibly a wrong SQLSTATE) concerning directory-open or file-open failures. It also fixes places where we took shortcuts in r

pgsql: Clean up assorted messiness around AllocateDir() usage.

2017-12-04 Thread Tom Lane
Clean up assorted messiness around AllocateDir() usage. This patch fixes a couple of low-probability bugs that could lead to reporting an irrelevant errno value (and hence possibly a wrong SQLSTATE) concerning directory-open or file-open failures. It also fixes places where we took shortcuts in r

pgsql: When VACUUM or ANALYZE skips a concurrently dropped table, log i

2017-12-04 Thread Robert Haas
When VACUUM or ANALYZE skips a concurrently dropped table, log it. Hopefully, the additional logging will help avoid confusion that could otherwise result. Nathan Bossart, reviewed by Michael Paquier, Fabrízio Mello, and me Branch -- master Details --- https://git.postgresql.org/pg/comm

Re: pgsql: Add some regression tests that exercise hash join code.

2017-12-04 Thread Andres Freund
On 2017-12-04 12:28:56 +1300, Thomas Munro wrote: > From 43eeea0bc35204440d262224b56efca958b33428 Mon Sep 17 00:00:00 2001 > From: Thomas Munro > Date: Mon, 4 Dec 2017 11:52:11 +1300 > Subject: [PATCH] Fix EXPLAIN ANALYZE of hash join when the leader doesn't > execute. > > If a hash join appears

pgsql: Support boolean columns in functional-dependency statistics.

2017-12-04 Thread Tom Lane
Support boolean columns in functional-dependency statistics. There's no good reason that the multicolumn stats stuff shouldn't work on booleans. But it looked only for "Var = pseudoconstant" clauses, and it will seldom find those for boolean Vars, since earlier phases of planning will fold "boolv

pgsql: Support boolean columns in functional-dependency statistics.

2017-12-04 Thread Tom Lane
Support boolean columns in functional-dependency statistics. There's no good reason that the multicolumn stats stuff shouldn't work on booleans. But it looked only for "Var = pseudoconstant" clauses, and it will seldom find those for boolean Vars, since earlier phases of planning will fold "boolv

pgsql: Remove memory leak protection from Gather and Gather Merge nodes

2017-12-04 Thread Robert Haas
Remove memory leak protection from Gather and Gather Merge nodes. Before commit 6b65a7fe62e129d5c2b85cd74d6a91d8f7564608, tqueue.c could perform tuple remapping and thus leak memory, which is why commit af33039317ddc4a0e38a02e2255c2bf453115fd2 made TupleQueueReaderNext run in a short-lived context