Re: pgsql: Refactor attribute mappings used in logical tuple conversion

2019-12-17 Thread er
On 2019-12-18 08:25, Michael Paquier wrote: Refactor attribute mappings used in logical tuple conversion gcc (9.2.0) mutters this: tupconvert.c: In function ‘execute_attr_map_tuple’: tupconvert.c:146:8: warning: unused variable ‘outnatts’ [-Wunused-variable] 146 | int outnatts = map->o

pgsql: Refactor attribute mappings used in logical tuple conversion

2019-12-17 Thread Michael Paquier
Refactor attribute mappings used in logical tuple conversion Tuple conversion support in tupconvert.c is able to convert rowtypes between two relations, inner and outer, which are logically equivalent but have a different ordering or even dropped columns (used mainly for inheritance tree and parti

pgsql: Fix subscriber invalid memory access on DDL.

2019-12-17 Thread Amit Kapila
Fix subscriber invalid memory access on DDL. This patch allows building the local relmap cache for a subscribed relation after processing pending invalidation messages and potential relcache updates. Without this, the attributes in the local cache don't tally with the updated relcache entry leadi

pgsql: Fix subscriber invalid memory access on DDL.

2019-12-17 Thread Amit Kapila
Fix subscriber invalid memory access on DDL. This patch allows building the local relmap cache for a subscribed relation after processing pending invalidation messages and potential relcache updates. Without this, the attributes in the local cache don't tally with the updated relcache entry leadi

pgsql: Fix subscriber invalid memory access on DDL.

2019-12-17 Thread Amit Kapila
Fix subscriber invalid memory access on DDL. This patch allows building the local relmap cache for a subscribed relation after processing pending invalidation messages and potential relcache updates. Without this, the attributes in the local cache don't tally with the updated relcache entry leadi

pgsql: Fix subscriber invalid memory access on DDL.

2019-12-17 Thread Amit Kapila
Fix subscriber invalid memory access on DDL. This patch allows building the local relmap cache for a subscribed relation after processing pending invalidation messages and potential relcache updates. Without this, the attributes in the local cache don't tally with the updated relcache entry leadi

pgsql: Doc: Improve readability of options for REINDEX

2019-12-17 Thread Michael Paquier
Doc: Improve readability of options for REINDEX That's more consistent with the style we have been using with for example EXPLAIN, VACUUM or ANALYZE (this one had only one option in v11). Based on a suggestion from Pavel Stehule. Author: Josef Šimánek Discussion: https://postgr.es/m/CAFj8pRCrUS

pgsql: Fix some OBJS lists in two Makefiles to be ordered alphabeticall

2019-12-17 Thread Michael Paquier
Fix some OBJS lists in two Makefiles to be ordered alphabetically These have been missed in 01368e5, and count for plpython and the backend's tsearch code. Author: Mahendra Singh Discussion: https://postgr.es/m/cakytnao4mxrrydb0yqe6qlh17xd7ppqotpgm3gnhs+gqkz4...@mail.gmail.com Branch -- mas

pgsql: Remove redundant not-null test

2019-12-17 Thread Bruce Momjian
Remove redundant not-null test Reported-by: Ranier Vilela Discussion: https://postgr.es/m/mn2pr18mb2927e73fadca8967b2302469e3...@mn2pr18mb2927.namprd18.prod.outlook.com Author: Ranier Vilela Backpatch-through: master Branch -- master Details --- https://git.postgresql.org/pg/commitdi

pgsql: Remove shadow variables linked to RedoRecPtr in xlog.c

2019-12-17 Thread Michael Paquier
Remove shadow variables linked to RedoRecPtr in xlog.c This changes the routines in charge of recycling WAL segments past the last redo LSN to not use anymore "RedoRecPtr" as a local variable, which is also available in the context of the session as a static declaration, replacing it with "lastred

pgsql: Remove shadow variables linked to RedoRecPtr in xlog.c

2019-12-17 Thread Michael Paquier
Remove shadow variables linked to RedoRecPtr in xlog.c This changes the routines in charge of recycling WAL segments past the last redo LSN to not use anymore "RedoRecPtr" as a local variable, which is also available in the context of the session as a static declaration, replacing it with "lastred

pgsql: Remove shadow variables linked to RedoRecPtr in xlog.c

2019-12-17 Thread Michael Paquier
Remove shadow variables linked to RedoRecPtr in xlog.c This changes the routines in charge of recycling WAL segments past the last redo LSN to not use anymore "RedoRecPtr" as a local variable, which is also available in the context of the session as a static declaration, replacing it with "lastred

pgsql: Fix error reporting for index expressions of prohibited types.

2019-12-17 Thread Tom Lane
Fix error reporting for index expressions of prohibited types. If CheckAttributeType() threw an error about the datatype of an index expression column, it would report an empty column name, which is pretty unhelpful and certainly not the intended behavior. I (tgl) evidently broke this in commit cf

pgsql: Fix error reporting for index expressions of prohibited types.

2019-12-17 Thread Tom Lane
Fix error reporting for index expressions of prohibited types. If CheckAttributeType() threw an error about the datatype of an index expression column, it would report an empty column name, which is pretty unhelpful and certainly not the intended behavior. I (tgl) evidently broke this in commit cf

pgsql: Fix error reporting for index expressions of prohibited types.

2019-12-17 Thread Tom Lane
Fix error reporting for index expressions of prohibited types. If CheckAttributeType() threw an error about the datatype of an index expression column, it would report an empty column name, which is pretty unhelpful and certainly not the intended behavior. I (tgl) evidently broke this in commit cf

pgsql: Fix error reporting for index expressions of prohibited types.

2019-12-17 Thread Tom Lane
Fix error reporting for index expressions of prohibited types. If CheckAttributeType() threw an error about the datatype of an index expression column, it would report an empty column name, which is pretty unhelpful and certainly not the intended behavior. I (tgl) evidently broke this in commit cf

pgsql: Fix error reporting for index expressions of prohibited types.

2019-12-17 Thread Tom Lane
Fix error reporting for index expressions of prohibited types. If CheckAttributeType() threw an error about the datatype of an index expression column, it would report an empty column name, which is pretty unhelpful and certainly not the intended behavior. I (tgl) evidently broke this in commit cf

pgsql: Fix error reporting for index expressions of prohibited types.

2019-12-17 Thread Tom Lane
Fix error reporting for index expressions of prohibited types. If CheckAttributeType() threw an error about the datatype of an index expression column, it would report an empty column name, which is pretty unhelpful and certainly not the intended behavior. I (tgl) evidently broke this in commit cf

pgsql: Fix error reporting for index expressions of prohibited types.

2019-12-17 Thread Tom Lane
Fix error reporting for index expressions of prohibited types. If CheckAttributeType() threw an error about the datatype of an index expression column, it would report an empty column name, which is pretty unhelpful and certainly not the intended behavior. I (tgl) evidently broke this in commit cf

Re: pgsql: Code cleanup for toast_fetch_datum and toast_fetch_datum_slice.

2019-12-17 Thread Robert Haas
On Tue, Dec 17, 2019 at 3:54 PM Tom Lane wrote: > Robert Haas writes: > > On Tue, Dec 17, 2019 at 2:52 PM Robert Haas wrote: > >> Code cleanup for toast_fetch_datum and toast_fetch_datum_slice. > > > florican seems unhappy with this. Looking at it now. > > lapwing as well; maybe some 64-bit-ish

pgsql: Fix bad formula in previous commit.

2019-12-17 Thread Robert Haas
Fix bad formula in previous commit. Commit d5406dea25b600408e7acf17d5a06e82d3ce6d0d used a slightly novel, and wrong, approach to compute the length of the last toast chunk. It worked fine unless the last chunk happened to have the largest possible size. Branch -- master Details --- http

Re: pgsql: Code cleanup for toast_fetch_datum and toast_fetch_datum_slice.

2019-12-17 Thread Tom Lane
Robert Haas writes: > On Tue, Dec 17, 2019 at 2:52 PM Robert Haas wrote: >> Code cleanup for toast_fetch_datum and toast_fetch_datum_slice. > florican seems unhappy with this. Looking at it now. lapwing as well; maybe some 64-bit-ish assumptions in there? regards, tom l

Re: pgsql: Code cleanup for toast_fetch_datum and toast_fetch_datum_slice.

2019-12-17 Thread Robert Haas
On Tue, Dec 17, 2019 at 2:52 PM Robert Haas wrote: > Code cleanup for toast_fetch_datum and toast_fetch_datum_slice. florican seems unhappy with this. Looking at it now. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company

pgsql: Code cleanup for toast_fetch_datum and toast_fetch_datum_slice.

2019-12-17 Thread Robert Haas
Code cleanup for toast_fetch_datum and toast_fetch_datum_slice. Rework some of the checks for bad TOAST chunks to be a bit simpler and easier to understand. These checks verify that (1) we get all and only the chunk numbers we expect to see and (2) each chunk has the expected size. However, the ex

pgsql: simplehash: Allow for use in frontend code.

2019-12-17 Thread Robert Haas
simplehash: Allow for use in frontend code. Commit 48995040d5e7b1e9bac35d72aff326cae002219d removed the largest barrier to use of simplehash in frontend code, but there's one more problem: it uses elog(ERROR, ...) or elog(LOG, ...) in a couple of places. Work around that by changing those to pg_lo

pgsql: simplehash: Allow use of simplehash without MemoryContext.

2019-12-17 Thread Robert Haas
simplehash: Allow use of simplehash without MemoryContext. If the SH_RAW_ALLOCATOR is defined, it will be used to allocate bytes for the hash table, and no dependencies on MemoryContext will exist. This means, in particular, that the SH_CREATE function will not take a MemoryContext argument. Patc

Re: pgsql: Move interrupt-handling code into subroutines.

2019-12-17 Thread Robert Haas
On Tue, Dec 17, 2019 at 1:43 PM Andrew Gierth wrote: > > "Robert" == Robert Haas writes: > > Robert> Move interrupt-handling code into subroutines. > > This is eliciting compiler warnings from gcc, which apparently doesn't > count "static void foo();" as being a prototype (quite reasonably,

pgsql: Add missing "void" to prototypes.

2019-12-17 Thread Robert Haas
Add missing "void" to prototypes. Commit 5910d6c7e311f0b14e3d3cb9ce3597c01d3a3cde got this wrong. Report and patch by Andrew Gierth. Discussion: http://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b1cc572f1274

Re: pgsql: Move interrupt-handling code into subroutines.

2019-12-17 Thread Andrew Gierth
> "Robert" == Robert Haas writes: Robert> Move interrupt-handling code into subroutines. This is eliciting compiler warnings from gcc, which apparently doesn't count "static void foo();" as being a prototype (quite reasonably, since it's not). Needs this fix (in autovacuum.c and checkpoint

pgsql: Partially deduplicate interrupt handling for background processe

2019-12-17 Thread Robert Haas
Partially deduplicate interrupt handling for background processes. Where possible, share signal handler code and main loop interrupt checking. This saves quite a bit of code and should simplify maintenance, too. This commit intends not to change the way anything works, even though that might allo

pgsql: Use PostgresSigHupHandler in more places.

2019-12-17 Thread Robert Haas
Use PostgresSigHupHandler in more places. There seems to be no reason for every background process to have its own flag indicating that a config-file reload is needed. Instead, let's just use ConfigFilePending for that purpose everywhere. Patch by me, reviewed by Andres Freund and Daniel Gustafss

pgsql: Move interrupt-handling code into subroutines.

2019-12-17 Thread Robert Haas
Move interrupt-handling code into subroutines. Some auxiliary processes, as well as the autovacuum launcher, have interrupt handling code directly in their main loops. Try to abstract things a little better by moving it into separate functions. This doesn't make any functional difference, and lea