[COMMITTERS] pgsql: Refactor get_partition_for_tuple a bit.

2017-09-07 Thread Robert Haas
Refactor get_partition_for_tuple a bit. Pending patches for both default partitioning and hash partitioning find the current coding pattern to be inconvenient. Change it so that we switch on the partitioning method first and then do whatever is needed. Amul Sul, reviewed by Jeevan Ladhe, with a

[COMMITTERS] pgsql: Improve performance of get_actual_variable_range with recently-d

2017-09-07 Thread Tom Lane
Improve performance of get_actual_variable_range with recently-dead tuples. In commit fccebe421, we hacked get_actual_variable_range() to scan the index with SnapshotDirty, so that if there are many uncommitted tuples at the end of the index range, it wouldn't laboriously scan through all of them

[COMMITTERS] pgsql: Improve documentation about behavior of multi-statement Query me

2017-09-07 Thread Tom Lane
Improve documentation about behavior of multi-statement Query messages. We've long done our best to sweep this topic under the rug, but in view of recent work it seems like it's time to explain it more precisely. Here's an initial cut at doing that. Discussion: https://postgr.es/m/0A3221C70F24FB

[COMMITTERS] pgsql: Reduce excessive dereferencing of function pointers

2017-09-07 Thread Peter Eisentraut
Reduce excessive dereferencing of function pointers It is equivalent in ANSI C to write (*funcptr) () and funcptr(). These two styles have been applied inconsistently. After discussion, we'll use the more verbose style for plain function pointer variables, to make it clear that it's a variable,

[COMMITTERS] pgsql: Even if some partitions are foreign, allow tuple routing.

2017-09-07 Thread Robert Haas
Even if some partitions are foreign, allow tuple routing. This doesn't allow routing tuple to the foreign partitions themselves, but it permits tuples to be routed to regular partitions despite the presence of foreign partitions in the same inheritance hierarchy. Etsuro Fujita, reviewed by Amit L

[COMMITTERS] pgsql: Even if some partitions are foreign, allow tuple routing.

2017-09-07 Thread Robert Haas
Even if some partitions are foreign, allow tuple routing. This doesn't allow routing tuple to the foreign partitions themselves, but it permits tuples to be routed to regular partitions despite the presence of foreign partitions in the same inheritance hierarchy. Etsuro Fujita, reviewed by Amit L

[COMMITTERS] pgsql: Fix handling of savepoint commands within multi-statement Query

2017-09-07 Thread Tom Lane
Fix handling of savepoint commands within multi-statement Query strings. Issuing a savepoint-related command in a Query message that contains multiple SQL statements led to a FATAL exit with a complaint about "unexpected state STARTED". This is a shortcoming of commit 4f896dac1, which attempted t

[COMMITTERS] pgsql: Further marginal hacking on generic atomic ops.

2017-09-07 Thread Tom Lane
Further marginal hacking on generic atomic ops. In the generic atomic ops that rely on a loop around a CAS primitive, there's no need to force the initial read of the "old" value to be atomic. In the typically-rare case that we get a torn value, that simply means that the first CAS attempt will fa

[COMMITTERS] pgsql: Exclude special values in recovery_target_time

2017-09-07 Thread Simon Riggs
Exclude special values in recovery_target_time recovery_target_time accepts timestamp input, though does not allow use of special values, e.g. “today”. Report a useful error message for these cases. Reported-by: Piotr Stefaniak Author: Simon Riggs Discussion: https://postgr.es/m/canp8+jjdka+bkky

[COMMITTERS] pgsql: Fix translatable string

2017-09-07 Thread Alvaro Herrera
Fix translatable string Discussion: https://postgr.es/m/20170828130545.sdajqlpr37hmmd6a@alvherre.pgsql Branch -- REL9_5_STABLE Details --- https://git.postgresql.org/pg/commitdiff/8d5ec8ee38090989d1f626d9dc477960206bd9dc Modified Files -- src/bin/pg_rewind/libpq_fetch.c | 10