[COMMITTERS] pgsql: Fix off-by-one in memory allocation for quote_literal_cstr().

2016-12-16 Thread Heikki Linnakangas
Fix off-by-one in memory allocation for quote_literal_cstr(). The calculation didn't take into account the NULL terminator. That lead to overwriting the palloc'd buffer by one byte, if the input consists entirely of backslashes. For example "format('%L', E'\\')". Fixes bug #14468. Backpatch to al

[COMMITTERS] pgsql: Fix off-by-one in memory allocation for quote_literal_cstr().

2016-12-16 Thread Heikki Linnakangas
Fix off-by-one in memory allocation for quote_literal_cstr(). The calculation didn't take into account the NULL terminator. That lead to overwriting the palloc'd buffer by one byte, if the input consists entirely of backslashes. For example "format('%L', E'\\')". Fixes bug #14468. Backpatch to al

[COMMITTERS] pgsql: Fix off-by-one in memory allocation for quote_literal_cstr().

2016-12-16 Thread Heikki Linnakangas
Fix off-by-one in memory allocation for quote_literal_cstr(). The calculation didn't take into account the NULL terminator. That lead to overwriting the palloc'd buffer by one byte, if the input consists entirely of backslashes. For example "format('%L', E'\\')". Fixes bug #14468. Backpatch to al

[COMMITTERS] pgsql: Fix off-by-one in memory allocation for quote_literal_cstr().

2016-12-16 Thread Heikki Linnakangas
Fix off-by-one in memory allocation for quote_literal_cstr(). The calculation didn't take into account the NULL terminator. That lead to overwriting the palloc'd buffer by one byte, if the input consists entirely of backslashes. For example "format('%L', E'\\')". Fixes bug #14468. Backpatch to al

[COMMITTERS] pgsql: Fix off-by-one in memory allocation for quote_literal_cstr().

2016-12-16 Thread Heikki Linnakangas
Fix off-by-one in memory allocation for quote_literal_cstr(). The calculation didn't take into account the NULL terminator. That lead to overwriting the palloc'd buffer by one byte, if the input consists entirely of backslashes. For example "format('%L', E'\\')". Fixes bug #14468. Backpatch to al

[COMMITTERS] pgsql: Fix off-by-one in memory allocation for quote_literal_cstr().

2016-12-16 Thread Heikki Linnakangas
Fix off-by-one in memory allocation for quote_literal_cstr(). The calculation didn't take into account the NULL terminator. That lead to overwriting the palloc'd buffer by one byte, if the input consists entirely of backslashes. For example "format('%L', E'\\')". Fixes bug #14468. Backpatch to al

[COMMITTERS] pgsql: Remove _hash_wrtbuf() in favor of calling MarkBufferDirty().

2016-12-16 Thread Robert Haas
Remove _hash_wrtbuf() in favor of calling MarkBufferDirty(). The whole concept of _hash_wrtbuf() is that we need to know at the time we're releasing the buffer lock (and pin) whether we dirtied the buffer, but this is easy to get wrong. This patch actually fixes one non-obvious bug of that form:

[COMMITTERS] pgsql: Fix more hash index bugs around marking buffers dirty.

2016-12-16 Thread Robert Haas
Fix more hash index bugs around marking buffers dirty. In _hash_freeovflpage(), if we're freeing the overflow page that immediate follows the page to which tuples are being moved (the confusingly-named "write buffer"), don't forget to mark that page dirty after updating its hasho_nextblkno. In _h

[COMMITTERS] pgsql: Unbreak Finalize HashAggregate over Partial HashAggregate.

2016-12-16 Thread Robert Haas
Unbreak Finalize HashAggregate over Partial HashAggregate. Commit 5dfc198146b49ce7ecc8a1fc9d5e171fb75f6ba5 introduced the use of a new type of hash table with linear reprobing for hash aggregates. Such a hash table behaves very poorly if keys are inserted in hash order, which does in fact happen i

[COMMITTERS] pgsql: Add missing documentation for effective_io_concurrency tablespac

2016-12-16 Thread Fujii Masao
Add missing documentation for effective_io_concurrency tablespace option. The description of effective_io_concurrency option was missing in ALTER TABLESPACE docs though it's included in CREATE TABLESPACE one. Back-patch to 9.6 where effective_io_concurrency tablespace option was added. Michael P

[COMMITTERS] pgsql: Add missing documentation for effective_io_concurrency tablespac

2016-12-16 Thread Fujii Masao
Add missing documentation for effective_io_concurrency tablespace option. The description of effective_io_concurrency option was missing in ALTER TABLESPACE docs though it's included in CREATE TABLESPACE one. Back-patch to 9.6 where effective_io_concurrency tablespace option was added. Michael P

[COMMITTERS] pgsql: Improve documentation around TS_execute().

2016-12-16 Thread Tom Lane
Improve documentation around TS_execute(). I got frustrated by the lack of commentary in this area, so here is some reverse-engineered documentation, along with minor stylistic cleanup. No code changes more significant than removal of unused variables. Back-patch to 9.6, not because that's useful

[COMMITTERS] pgsql: Improve documentation around TS_execute().

2016-12-16 Thread Tom Lane
Improve documentation around TS_execute(). I got frustrated by the lack of commentary in this area, so here is some reverse-engineered documentation, along with minor stylistic cleanup. No code changes more significant than removal of unused variables. Back-patch to 9.6, not because that's useful

[COMMITTERS] pgsql: Simplify LWLock tranche machinery by removing array_base/array_s

2016-12-16 Thread Robert Haas
Simplify LWLock tranche machinery by removing array_base/array_stride. array_base and array_stride were added so that we could identify the offset of an LWLock within a tranche, but this facility is only very marginally used apart from the main tranche. So, give every lock in the main tranche its

[COMMITTERS] pgsql: Ensure that num_sync is greater than zero in synchronous_standby

2016-12-16 Thread Fujii Masao
Ensure that num_sync is greater than zero in synchronous_standby_names. Previously num_sync could be set to zero and this setting caused an assertion failure. This means that multiple synchronous standbys code should assume that num_sync is greater than zero. Also setting num_sync to zero is nonse

[COMMITTERS] pgsql: Ensure that num_sync is greater than zero in synchronous_standby

2016-12-16 Thread Fujii Masao
Ensure that num_sync is greater than zero in synchronous_standby_names. Previously num_sync could be set to zero and this setting caused an assertion failure. This means that multiple synchronous standbys code should assume that num_sync is greater than zero. Also setting num_sync to zero is nonse

[COMMITTERS] pgsql: Fix outdated comment in lwlock.c

2016-12-16 Thread Robert Haas
Fix outdated comment in lwlock.c Commit 3761fe3c20bb040b15f0e8da58d824631da00caa should have made this change, but didn't. Reported by Álvaro Herrera. Branch -- master Details --- http://git.postgresql.org/pg/commitdiff/591ccb66d24258f6d1084343b3c33c96e3e2b36d Modified Files --