[COMMITTERS] pgsql: Avoid core dump for empty prepared statement in an aborted trans

2017-01-19 Thread Tom Lane
Avoid core dump for empty prepared statement in an aborted transaction. Brown-paper-bag bug in commit ab1f0c822: the old code here coped with null CachedPlanSource.raw_parse_tree, the new code not so much. Per report from Dave Cramer. No regression test, because our core testing infrastructure do

[COMMITTERS] pgsql: Fix Assert failure induced by commit 215b43cdc.

2017-01-19 Thread Tom Lane
Fix Assert failure induced by commit 215b43cdc. I'd somehow talked myself into believing that set_append_rel_size doesn't need to worry about getting back an AND clause when it applies eval_const_expressions to the result of adjust_appendrel_attrs (that is, transposing the appendrel parent's restr

[COMMITTERS] pgsql: Fix platform dependant regression output triggered by 69f4b9c85f

2017-01-19 Thread Andres Freund
Fix platform dependant regression output triggered by 69f4b9c85f16. Due to the changed costing in that commit hash-aggregates started to be used, which results in big-endian vs. little-endian output differences. Disable hash-aggs for those tests. Author: Andres Freund, with input from Tom Lane D

[COMMITTERS] pgsql: Remove obsoleted code relating to targetlist SRF evaluation.

2017-01-19 Thread Andres Freund
Remove obsoleted code relating to targetlist SRF evaluation. Since 69f4b9c plain expression evaluation (and thus normal projection) can't return sets of tuples anymore. Thus remove code dealing with that possibility. This will require adjustments in external code using ExecEvalExpr()/ExecProject(

Re: [COMMITTERS] pgsql: Adapt python regression tests to 69f4b9c85f16.

2017-01-19 Thread Andres Freund
Hi, On 2017-01-18 21:09:52 -0500, Tom Lane wrote: > I wrote: > > If you don't want an ORDER BY, maybe turn off enable_hashagg for > > these queries? But you'll get the same plan either way. > > Or not ... I forgot it has a better model of the rowcount changes now: > regression=# set enable_hash

[COMMITTERS] pgsql: Fix race condition in reading commit timestamps

2017-01-19 Thread Alvaro Herrera
Fix race condition in reading commit timestamps If a user requests the commit timestamp for a transaction old enough that its data is concurrently being truncated away by vacuum at just the right time, they would receive an ugly internal file-not-found error message from slru.c rather than the exp

Re: [COMMITTERS] pgsql: Add function to import operating system collations

2017-01-19 Thread Peter Eisentraut
On 1/19/17 11:58 AM, Tom Lane wrote: > Stephen Frost writes: >> * Tom Lane (t...@sss.pgh.pa.us) wrote: >>> WFM. Btw, I noticed that BOOTSTRAP_SUPERUSERID is hard-coded as "10" >>> in this bit in setup_privileges(): > >> Hm. I seem to recall trying to avoid having the hard-coded value there >> b

[COMMITTERS] pgsql: initdb: Fix for mixed-case superuser names

2017-01-19 Thread Peter Eisentraut
initdb: Fix for mixed-case superuser names The previous coding did not properly quote the user name before casting it to regrole. To avoid all that, just pass in BOOTSTRAP_SUPERUSERID numerically. Also fix one place where the BOOTSTRAP_SUPERUSERID was hardcoded as 10. Branch -- master Deta

[COMMITTERS] pgsql: Teach partitioning tests not to use DROP TABLE ... CASCADE.

2017-01-19 Thread Robert Haas
Teach partitioning tests not to use DROP TABLE ... CASCADE. This occasionally causes failures; the order in which the affected objects are listed is not 100% consistent. Amit Langote Branch -- master Details --- http://git.postgresql.org/pg/commitdiff/c3978149536a9c3fb837524407c58dec2b1

[COMMITTERS] pgsql: Avoid some code duplication in map_partition_varattnos().

2017-01-19 Thread Robert Haas
Avoid some code duplication in map_partition_varattnos(). Code to map attribute numbers in map_partition_varattnos() duplicates what convert_tuples_by_name_map() does. Avoid that. Amit Langote, per a report from Álvaro Herrera. Discussion: http://postgr.es/m/9ce97382-54c8-deb3-9ee9-a2ec271d866

[COMMITTERS] pgsql: Fix some problems in check_new_partition_bound().

2017-01-19 Thread Robert Haas
Fix some problems in check_new_partition_bound(). Account for the fact that the highest bound less than or equal to the upper bound might be either the lower or the upper bound of the overlapping partition, depending on whether the proposed partition completely contains the existing partition or m

[COMMITTERS] pgsql: Fix RETURNING to work correctly with partition tuple routing.

2017-01-19 Thread Robert Haas
Fix RETURNING to work correctly with partition tuple routing. In ExecInsert(), do not switch back to the root partitioned table ResultRelInfo until after we finish ExecProcessReturning(), so that RETURNING projection is done using the partition's descriptor. For the projection to work correctly,

[COMMITTERS] pgsql: Fix failure to enforce partitioning contraint for internal parti

2017-01-19 Thread Robert Haas
Fix failure to enforce partitioning contraint for internal partitions. When a tuple is inherited into a partitioning root, no partition constraints need to be enforced; when it is inserted into a leaf, the parent's partitioning quals needed to be enforced. The previous coding got both of those ca

[COMMITTERS] pgsql: Dump sequence data based on the TableDataInfo flag

2017-01-19 Thread Stephen Frost
Dump sequence data based on the TableDataInfo flag When considering a sequence's Data entry in dumpSequenceData, we were actually looking at the sequence definition's dump flag to decide if we should dump the data or not. That's generally fine, except for when the sequence data entry was created

[COMMITTERS] pgsql: Dump sequence data based on the TableDataInfo flag

2017-01-19 Thread Stephen Frost
Dump sequence data based on the TableDataInfo flag When considering a sequence's Data entry in dumpSequenceData, we were actually looking at the sequence definition's dump flag to decide if we should dump the data or not. That's generally fine, except for when the sequence data entry was created

Re: [COMMITTERS] pgsql: Add function to import operating system collations

2017-01-19 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > * Tom Lane (t...@sss.pgh.pa.us) wrote: > >> WFM. Btw, I noticed that BOOTSTRAP_SUPERUSERID is hard-coded as "10" > >> in this bit in setup_privileges(): > > > Hm. I seem to recall trying to avoid having the hard-coded value ther

Re: [COMMITTERS] pgsql: Add function to import operating system collations

2017-01-19 Thread Tom Lane
Stephen Frost writes: > * Tom Lane (t...@sss.pgh.pa.us) wrote: >> WFM. Btw, I noticed that BOOTSTRAP_SUPERUSERID is hard-coded as "10" >> in this bit in setup_privileges(): > Hm. I seem to recall trying to avoid having the hard-coded value there > but we don't have BOOTSTRAP_SUPERUSERID defined

Re: [COMMITTERS] pgsql: Add function to import operating system collations

2017-01-19 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: > Peter Eisentraut writes: > > On 1/19/17 7:53 AM, Tom Lane wrote: > >> Hm. I see that the patch randomly changed the way that the collation > >> owner is generated ... looks like it no longer works for mixed-case > >> usernames. Perhaps follow this model i

Re: [COMMITTERS] pgsql: Add function to import operating system collations

2017-01-19 Thread Tom Lane
Peter Eisentraut writes: > On 1/19/17 7:53 AM, Tom Lane wrote: >> Hm. I see that the patch randomly changed the way that the collation >> owner is generated ... looks like it no longer works for mixed-case >> usernames. Perhaps follow this model instead: > We could just use the numeric value, l

Re: [COMMITTERS] pgsql: Add function to import operating system collations

2017-01-19 Thread Peter Eisentraut
On 1/19/17 7:53 AM, Tom Lane wrote: > Hm. I see that the patch randomly changed the way that the collation > owner is generated ... looks like it no longer works for mixed-case > usernames. Perhaps follow this model instead: > > if (superuser_password) > PG_CMD_PRINTF2("ALTER

Re: [COMMITTERS] pgsql: Add function to import operating system collations

2017-01-19 Thread Tom Lane
Amit Kapila writes: > On Wed, Jan 18, 2017 at 8:06 PM, Peter Eisentraut wrote: >> Add function to import operating system collations > After this commit, initdb is failing with below error on one of my VM > m/c (Linux amitkapila-centos-vm 2.6.32-358.11.1.el6.x86_64): > performing post-bootstrap

[COMMITTERS] pgsql: Allow negative years in make_date to represent BC years

2017-01-19 Thread Alvaro Herrera
Allow negative years in make_date to represent BC years There doesn't seem to be any reason not to allow negative years to be interpreted as BC, so do that. The documentation is pretty vague on the details of this function, so nothing needs to change there. Reported-by: Andy Abelisto, in bug #14

Re: [COMMITTERS] pgsql: Add function to import operating system collations

2017-01-19 Thread Amit Kapila
On Wed, Jan 18, 2017 at 8:06 PM, Peter Eisentraut wrote: > Add function to import operating system collations > After this commit, initdb is failing with below error on one of my VM m/c (Linux amitkapila-centos-vm 2.6.32-358.11.1.el6.x86_64): ./initdb -D ../../data The files belonging to this d