pgsql: Try to stabilize EXPLAIN output in partition_check test.

2018-02-22 Thread Robert Haas
Try to stabilize EXPLAIN output in partition_check test.

Commit 7d8ac9814bc9bb6df2d845dbabed38d7284c7c2c adjusted these
tests in the hope of preserving the plan shape, but I failed to
notice that the three partitions were, on my local machine, choosing
two different plan shapes.  This is probably related to the fact
that all three tables have exactly the same row count.  Try to
improve the situation by making pht1_e about half as large as
the other two.

Per Tom Lane and the buildfarm.

Discussion: http://postgr.es/m/25380.1519277...@sss.pgh.pa.us

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/9a5c4f58f36dc7c87619602a7a2ec7de5a287068

Modified Files
--
src/test/regress/expected/partition_join.out | 58 +---
src/test/regress/sql/partition_join.sql  |  2 +-
2 files changed, 27 insertions(+), 33 deletions(-)



pgsql: Avoid another valgrind complaint about write() of uninitalized b

2018-02-22 Thread Robert Haas
Avoid another valgrind complaint about write() of uninitalized bytes.

Peter Geoghegan, per buildfarm member skink and Andres Freund

Discussion: http://postgr.es/m/20180221053426.gp72lw67yfpzk...@alap3.anarazel.de

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/de6428afe13bb6eb1c99a70aada1a105966bc27e

Modified Files
--
src/backend/utils/sort/logtape.c | 12 
1 file changed, 12 insertions(+)



Re: pgsql: Avoid valgrind complaint about write() of uninitalized bytes.

2018-02-22 Thread Robert Haas
On Wed, Feb 21, 2018 at 3:18 PM, Peter Geoghegan  wrote:
> On Wed, Feb 21, 2018 at 10:55 AM, Peter Geoghegan  wrote:
>> Sure, but it looks like it has the exact same underlying cause to the
>> LogicalTapeFreeze() issue. It shouldn't be very hard to write an
>> equivalent patch for LogicalTapeRewindForRead() -- I pointed out that
>> this could happen there instead before the first patch went in, in
>> fact. My mistake was to imagine that that could never happen during
>> the regression tests.
>
> Attached patch does this. I cannot recreate this issue locally, but
> this should still fix it on skink.

Committed.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql: postgres_fdw: Fix interaction of PHVs with child joins.

2018-02-22 Thread Robert Haas
postgres_fdw: Fix interaction of PHVs with child joins.

Commit f49842d1ee31b976c681322f76025d7732e860f3 introduced the
concept of a child join, but did not update this code accordingly.

Ashutosh Bapat, with cosmetic changes by me

Discussion: 
http://postgr.es/m/CAFjFpRf=j_kpotw+bhzeurykbizr8ufsaxg6gpef6dkpgh-...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/84cb51b4e24b4e3a7057105971d0d385e179d978

Modified Files
--
contrib/postgres_fdw/expected/postgres_fdw.out | 40 ++
contrib/postgres_fdw/postgres_fdw.c|  6 +++-
contrib/postgres_fdw/sql/postgres_fdw.sql  |  5 
3 files changed, 50 insertions(+), 1 deletion(-)



pgsql: Remove extra word from comment.

2018-02-22 Thread Robert Haas
Remove extra word from comment.

Etsuro Fujita

Discussion: http://postgr.es/m/5a8eaf74.5010...@lab.ntt.co.jp

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/810e7e264ab547c404e32dba4f8733db53912084

Modified Files
--
src/backend/executor/execPartition.c | 8 
1 file changed, 4 insertions(+), 4 deletions(-)



pgsql: Be lazier about partition tuple routing.

2018-02-22 Thread Robert Haas
Be lazier about partition tuple routing.

It's not necessary to fully initialize the executor data structures
for partitions to which no tuples are ever routed.  Consider, for
example, an INSERT statement that inserts only one row: it only cares
about the partition to which that one row is routed.  The new function
ExecInitPartitionInfo performs the initialization in question only
when a particular partition is about to receive a tuple. This includes
creating, validating, and saving a pointer to the ResultRelInfo,
setting up for speculative insertions, translating WCOs and
initializing the resulting expressions, translating returning lists
and building the appropriate projection information, and setting up a
tuple conversion map.

One thing that's not deferred is locking the child partitions; that
seems desirable but would need more thought.  Still, testing shows
that this makes single-row inserts significantly faster on a table
with many partitions without harming the bulk-insert case.

Amit Langote, reviewed by Etsuro Fujita, with a few changes by me

Discussion: 
http://postgr.es/m/8975331d-d961-cbdd-f862-fdd3d97dc...@lab.ntt.co.jp

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/edd44738bc88148784899a8949519364d81d9ea8

Modified Files
--
src/backend/commands/copy.c|  10 +-
src/backend/executor/execPartition.c   | 359 +++--
src/backend/executor/nodeModifyTable.c | 133 +---
src/include/executor/execPartition.h   |   9 +-
4 files changed, 279 insertions(+), 232 deletions(-)



pgsql: Add user-callable SHA-2 functions

2018-02-22 Thread Peter Eisentraut
Add user-callable SHA-2 functions

Add the user-callable functions sha224, sha256, sha384, sha512.  We
already had these in the C code to support SCRAM, but there was no test
coverage outside of the SCRAM tests.  Adding these as user-callable
functions allows writing some tests.  Also, we have a user-callable md5
function but no more modern alternative, which led to wide use of md5 as
a general-purpose hash function, which leads to occasional complaints
about using md5.

Also mark the existing md5 functions as leak-proof.

Reviewed-by: Michael Paquier 

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/10cfce34c0fe20d2caed5750bbc5c315c0e4cc63

Modified Files
--
doc/src/sgml/func.sgml   |  71 -
src/backend/utils/adt/Makefile   |   3 +-
src/backend/utils/adt/cryptohashes.c | 169 +++
src/backend/utils/adt/varlena.c  |  48 -
src/include/catalog/pg_proc.h|  12 ++-
src/test/regress/expected/opr_sanity.out |   6 ++
src/test/regress/expected/strings.out|  53 ++
src/test/regress/sql/strings.sql |  18 
8 files changed, 328 insertions(+), 52 deletions(-)



pgsql: Update gratuitous use of MD5 in documentation

2018-02-22 Thread Peter Eisentraut
Update gratuitous use of MD5 in documentation

It seems some people are bothered by the outdated MD5 appearing in
example code.  So replace it with more modern alternatives or by
a different example function.

Reported-by: Jon Wolski 

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/0db2fc98cdf4135f9dcfa3740db6f2548682fe7e

Modified Files
--
doc/src/sgml/citext.sgml  | 10 +-
doc/src/sgml/sepgsql.sgml |  2 +-
2 files changed, 6 insertions(+), 6 deletions(-)



pgsql: Fix perlcritic warnings

2018-02-22 Thread Peter Eisentraut
Fix perlcritic warnings

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/abcba7001e481a565b8fba2393666dc54e90db61

Modified Files
--
src/bin/pgbench/t/001_pgbench_with_server.pl | 8 
1 file changed, 4 insertions(+), 4 deletions(-)



pgsql: Backport: Mark assorted GUC variables as PGDLLIMPORT.

2018-02-22 Thread Andres Freund
Backport: Mark assorted GUC variables as PGDLLIMPORT.

This backpatches 935dee9ad5a8d12f4d3b772a6e6c99d245e5ad44 to the
the branches requested by extension authors.

Original-Author: Metin Doslu
Original-Committer: Robert Haas
Author: Brian Cloutier

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2ff2baa220fc3eb5fba8de2864b619e648e86f17

Modified Files
--
src/include/miscadmin.h   |  2 +-
src/include/optimizer/cost.h  | 30 +++---
src/include/optimizer/paths.h |  8 
src/include/utils/guc.h   |  2 +-
4 files changed, 21 insertions(+), 21 deletions(-)



pgsql: Backport: Mark assorted GUC variables as PGDLLIMPORT.

2018-02-22 Thread Andres Freund
Backport: Mark assorted GUC variables as PGDLLIMPORT.

This backpatches 935dee9ad5a8d12f4d3b772a6e6c99d245e5ad44 to the
the branches requested by extension authors.

Original-Author: Metin Doslu
Original-Committer: Robert Haas
Author: Brian Cloutier

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/83fce670ea395c4e65c34886518273bf478615c4

Modified Files
--
src/include/optimizer/cost.h  | 28 ++--
src/include/optimizer/paths.h |  6 +++---
src/include/utils/guc.h   |  2 +-
3 files changed, 18 insertions(+), 18 deletions(-)



pgsql: Remove extra words.

2018-02-22 Thread Robert Haas
Remove extra words.

Thomas Munro

Discussion: 
http://postgr.es/m/CAEepm=2x3NUSPed6=-wdys39ktuu5dw3mk_namwps+18fmk...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/a6a80134e3bffa0678a82ed7477d9d46dea07d3a

Modified Files
--
src/backend/storage/lmgr/predicate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



pgsql: Support parameters in CALL

2018-02-22 Thread Peter Eisentraut
Support parameters in CALL

To support parameters in CALL, move the parse analysis of the procedure
and arguments into the global transformation phase, so that the parser
hooks can be applied.  And then at execution time pass the parameters
from ProcessUtility on to ExecuteCallStmt.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/76b6aa41f41db66004b1c430f17a546d4102fbe7

Modified Files
--
src/backend/commands/functioncmds.c| 25 +++---
src/backend/nodes/copyfuncs.c  |  1 +
src/backend/nodes/equalfuncs.c |  1 +
src/backend/parser/analyze.c   | 45 ++
src/backend/tcop/utility.c |  2 +-
src/include/commands/defrem.h  |  3 +-
src/include/nodes/parsenodes.h |  3 +-
src/pl/plpgsql/src/expected/plpgsql_call.out   | 19 +++
src/pl/plpgsql/src/sql/plpgsql_call.sql| 18 +++
src/test/regress/expected/create_procedure.out | 16 +
src/test/regress/sql/create_procedure.sql  | 15 +
11 files changed, 124 insertions(+), 24 deletions(-)