pgsql: Clear the local map when not used.

2019-02-28 Thread Amit Kapila
Clear the local map when not used. After commit b0eaa4c51b, we use a local map of pages to find the required space for small relations. We do clear this map when we have found a block with enough free space, when we extend the relation, or on transaction abort so that it can be used next time. H

pgsql: Make pg_partition_tree return no rows on unsupported and undefin

2019-02-28 Thread Michael Paquier
Make pg_partition_tree return no rows on unsupported and undefined objects The function was tweaked so as it returned one row full of NULLs when working on an unsupported relkind or an undefined object as of cc53123, and after discussion with Amit and Álvaro it looks more natural to make it return

Re: pgsql: Use slots in trigger infrastructure, except for the actual invoc

2019-02-28 Thread Andrew Dunstan
On 2/28/19 3:41 PM, Andres Freund wrote: > Hi, > > On 2019-02-27 10:16:21 -0800, Andres Freund wrote: >> On 2019-02-27 12:59:16 -0500, Andrew Dunstan wrote: >>> Backtraces should be enabled in the animal - I will investigate why >>> we're not getting them here. Meanwhile, here's one for this prob

pgsql: Don't superfluously materialize slot after DELETE from an FDW.

2019-02-28 Thread Andres Freund
Don't superfluously materialize slot after DELETE from an FDW. Previously that was needed to safely store the table oid, but after b8d71745eac0a127 that's not necessary anymore. Author: Andres Freund Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/253655116bb437d64

pgsql: Don't force materializing when copying a buffer tuple table slot

2019-02-28 Thread Andres Freund
Don't force materializing when copying a buffer tuple table slot. After 5408e233f0667478 it's not necessary to force materializing the target slot when copying from one buffer slot to another. Previously that was required because the HeapTupleData portion of the source slot wasn't guaranteed to st

pgsql: Improve docs for ALTER TABLE .. SET TABLESPACE

2019-02-28 Thread Alvaro Herrera
Improve docs for ALTER TABLE .. SET TABLESPACE Discussion: https://postgr.es/m/20190220173815.GA7959@alvherre.pgsql Reviewed-by: Robert Haas Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2c31825fb9a95914418f1e376917f60841a26c78 Modified Files -- doc/s

pgsql: Make get_controlfile not leak file descriptors

2019-02-28 Thread Joe Conway
Make get_controlfile not leak file descriptors When backend functions were added to expose controldata via SQL, reading of pg_control was consolidated under src/common so that both frontend and backend could share the same code. That move from frontend-only to shared frontend-backend failed to rec

Re: pgsql: Use slots in trigger infrastructure, except for the actual invoc

2019-02-28 Thread Andres Freund
Hi, On 2019-02-27 10:16:21 -0800, Andres Freund wrote: > On 2019-02-27 12:59:16 -0500, Andrew Dunstan wrote: > > Backtraces should be enabled in the animal - I will investigate why > > we're not getting them here. Meanwhile, here's one for this problem: > > Thanks, that helps! My first theories

pgsql: Allow buffer tuple table slots to materialize after ExecStoreVir

2019-02-28 Thread Andres Freund
Allow buffer tuple table slots to materialize after ExecStoreVirtualTuple(). While not common, it can be useful to store a virtual tuple into a buffer tuple table slot, and then materialize that slot. So far we've asserted out, which surprisingly wasn't a problem for anything in core. But that see

pgsql: pg_dump: Fix ArchiveEntry handling of some empty values

2019-02-28 Thread Alvaro Herrera
pg_dump: Fix ArchiveEntry handling of some empty values Commit f831d4acc changed what pg_dump emits for some empty fields: they were output as empty strings before, NULL pointer afterwards. That makes old pg_restore unable to work (crash) with such files, which is unacceptable. Return to the ori

pgsql: Merge near-duplicate code in RI triggers

2019-02-28 Thread Peter Eisentraut
Merge near-duplicate code in RI triggers Merge ri_setnull and ri_setdefault into one function ri_set. These functions were to a large part identical. This is a continuation in spirit of 4797f9b519995ceca5d6b8550b5caa2ff6d19347. Author: Corey Huinker Discussion: https://www.postgresql.org/mess

pgsql: Standardize some more loops that chase down parallel lists.

2019-02-28 Thread Tom Lane
Standardize some more loops that chase down parallel lists. We have forboth() and forthree() macros that simplify iterating through several parallel lists, but not everyplace that could reasonably use those was doing so. Also invent forfour() and forfive() macros to do the same for four or five p

pgsql: Clean up some variable names in ri_triggers.c

2019-02-28 Thread Peter Eisentraut
Clean up some variable names in ri_triggers.c There was a mix of old_slot/oldslot, new_slot/newslot. Since we've changed everything from row to slot, we might as well take this opportunity to clean this up. Also update some more comments for the slot change. Branch -- master Details --

pgsql: Reduce comments

2019-02-28 Thread Peter Eisentraut
Reduce comments Reduce the vertical space used by comments in ri_triggers.c, making the file longer and more tedious to read than it needs to be. Update some comments to use a more common style. Reviewed-by: Corey Huinker Discussion: https://www.postgresql.org/message-id/flat/0ccdd3e1-10b0-dd0

pgsql: Compact for loops

2019-02-28 Thread Peter Eisentraut
Compact for loops Declare loop variable in for loop, for readability and to save space. Reviewed-by: Corey Huinker Discussion: https://www.postgresql.org/message-id/flat/0ccdd3e1-10b0-dd05-d8a7-183507c11eb1%402ndquadrant.com Branch -- master Details --- https://git.postgresql.org/pg/c

pgsql: Remove unnecessary unused MATCH PARTIAL code

2019-02-28 Thread Peter Eisentraut
Remove unnecessary unused MATCH PARTIAL code ri_triggers.c spends a lot of space catering to a not-yet-implemented MATCH PARTIAL option. An actual implementation would probably not use the existing code structure anyway, so let's just simplify this for now. First, have ri_FetchConstraintInfo() c

pgsql: Update comment

2019-02-28 Thread Peter Eisentraut
Update comment for ff11e7f4b9ae017585c3ba146db7ba39c31f209a Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/22c0d52b8dc175fe46ebb6e0ab5b2be35e02be4e Modified Files -- src/backend/utils/adt/ri_triggers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(